What happens on closing ServerSocket

試著忘記壹切 提交于 2020-01-30 12:40:27

问题


What happens to client Sockets when I close a ServerSocket? Will all connections made with serverSocket.accept() be closed as well?


回答1:


Closing a ServerSocket will prevent new connections from being created, but it won't shut down existing connections.

ServerSocket is the listening socket involved only in creating a connection. The data communication is handled distinctly in the Socket returned by ServerSocket.accept();.



来源:https://stackoverflow.com/questions/36979335/what-happens-on-closing-serversocket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!