One Socket for listening and sending/receiving, simultaneously?
-
Hi, Is it possible to use the same Windows socket for listening (for new connections) and at the same time exchanging data (using the sendto() and recvfrom() functions)? Or must I have two separate sockets, and if so must the separate sockets also be bound to separate network ports? Just for the info, I am using WinSock 2 API functions. High thanks in advance :) Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
-
Hi, Is it possible to use the same Windows socket for listening (for new connections) and at the same time exchanging data (using the sendto() and recvfrom() functions)? Or must I have two separate sockets, and if so must the separate sockets also be bound to separate network ports? Just for the info, I am using WinSock 2 API functions. High thanks in advance :) Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
-
Sorry, didn't read your message correctly. When you 'accept' a connection on a listening socket then Windows will automatically create you a seperate socket with which you communicate to that client. You don't need to worry what port this is on as its all handled by the 'accept' call.
-
Sorry, didn't read your message correctly. When you 'accept' a connection on a listening socket then Windows will automatically create you a seperate socket with which you communicate to that client. You don't need to worry what port this is on as its all handled by the 'accept' call.
You must have misunderstood me (could be partly my fault sorry), I meant if it is possible to listen for incomming connections (not to accept them) and simultaneously communicate (sending/receiving) with a non-connected client? For ex: * socket S is created. * bind S to network address with specific port. * Create thread T. * set S to listen for incoming connections * meanwhile on thread T, socket S is sending and receiving messages. Is the above situation possible? :confused: Aidman » over and out We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.