Java sockets - Client doesn't read the strings from server's socket

前端 未结 2 1572
北恋
北恋 2020-12-11 14:15

I have two Java projects that communicate with sockets through strings. One is a client and the other is a server. The server accepts the connection trough the \"ServerSocke

2条回答
  •  星月不相逢
    2020-12-11 14:43

    Your server sends "USERNAME" and then waits. The client reads the next line, and blocks until it receives it. So you have a deadlock, since the server never sends an EOL character. If the client reads a line, the server should send a line.

提交回复
热议问题