Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们的应用程序需要连接一个套接字服务器,它有一个相当奇怪的设计,它提供了多个连接端口,但每个端口只有一个套接字客户端可以连接。如果后续套接字服务器尝试连接“已使用”的侦听套接字,则会被拒绝。
以这种方式设计套接字服务器是否有理由?我的问题是为什么?
我的猜测是它使用 UDP 套接字,并且每个端口只允许一个绑定,而不是 TCP 套接字,其中服务器侦听一个端口并且接受的连接由其他非侦听套接字处理。