异步套接字编程
我使用套接字编程创建了一个项目。如果我将单个客户端连接到我的服务器,则服务器会成功接收我从客户端发送的数据。但是每当我连接多个客户端时,服务器只接收一个客户端的数据。其他客户端无法连接。如何使服务器接受所有新的传入连接,以及如何使服务器从同一客户端接收两个文件?
I've created a project using socket programming. If I connect a single client to my server, the data I send from my client is successfully received by the server. But whenever I connect more than one client, only one client's data is received by the server. The other clients fail to connect. How can I make the server accept all new incoming connections, and how can I make the server receive two files from the same client?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的代码使用 BeginAccept、EndAccept 方法异步接受新连接,请不要忘记在 AcceptCallback 中调用 EndAccept 后再次调用 BeginAccept。
问候
If your code uses BeginAccept, EndAccept methods to accept new connection asynchonously, don't forget to call again BeginAccept after EndAccept call in your AcceptCallback.
Regards