gpt4 book ai didi

java - 一个服务器套接字如何与多个客户端套接字通信

转载 作者:行者123 更新时间:2023-11-29 03:26:43 25 4
gpt4 key购买 nike

我看过这篇文章

http://docs.oracle.com/javase/tutorial/networking/sockets/definition.html

因为它写道:

If everything goes well, the server accepts the connection. Upon acceptance, the server gets a new socket bound to the same local port and also has its remote endpoint set to the address and port of the client. It needs a new socket so that it can continue to listen to the original socket for connection requests while tending to the needs of the connected client.

那么服务器端是否存在多个具有相同端口的服务器套接字?

最佳答案

有一个ServerSocket .它通过 accept() 接受传入连接方法。这将返回 Socket您在服务器端使用它来处理与特定客户端的连接。

关于java - 一个服务器套接字如何与多个客户端套接字通信,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20684234/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com