简体   繁体   中英

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 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.

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

UDP是可能的,而TCP是不可能的,并且由于您提到了Accept()我假设您正在使用TCP,因此这是不可能的...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM