简体   繁体   English

Tcp Server 能否同时接收更多消息?

[英]Can Tcp Server receive more messages at the same time?

In a Tcp connection, can one Tcp Server receive two or more tcp messages at the same time from some different clients?在一个 Tcp 连接中,一个 Tcp Server 可以同时接收来自不同客户端的两个或多个 tcp 消息吗?

I have to make a small tool to manage a lot of communication from somee devices and a lot of frame exchange at the same time.我必须制作一个小工具来同时管理来自某些设备的大量通信和大量帧交换。

Could you give me an example?你能给我举个例子吗?

Thanks谢谢

Yes, as long as:是的,只要:

  1. they are on different TCP connections, and它们位于不同的 TCP 连接上,并且
  2. your socket reading code allows it - specifically, it won't work if you use a single reader based on Socket.Select , and您的套接字读取代码允许 - 具体来说,如果您使用基于Socket.Select的单个读取器,它将无法工作,并且
  3. you don't add any mutex/lock/etc that prevents full concurrency over the reading您不会添加任何阻止读取完全并发的互斥锁/锁/等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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