Using one socket object to send and receive multiple sockets in C#
In C#, I have a server application with multiple clients connecting. I will only keep track of the IP address and port when a new socket is instantiated upon开发者_如何学Go accept. My question is that using only one socket object can I accommodate sending and receiving? Is it possible for synchronous and asynchronous sockets? Examples will be helpful. Thanks in advance.
It's possible with UDP, it's not possible with TCP and since you mention Accept()
I assume you're using TCP and therefore it's not possible...
You have to use the socket object that is returned by accept method to send and receive to particular client. you can not use a single socket for all clients. socket is the end point through which communication is done
精彩评论