Is it possible to close Java sockets on both client and server sides?

前端 未结 5 846
灰色年华
灰色年华 2021-01-02 17:09

I have a socket tcp connection between two java applications. When one side closes the socket the other side remains open. but I want it to be closed. And also I can\'t wait

5条回答
  •  悲&欢浪女
    2021-01-02 17:16

    The usual solution is to let the other side know you are going to close the connection, before actually closing it. For instance, in the case of the SMTP protocol, the server will send '221 Bye' before it closes the connection.

提交回复
热议问题