我有一个类似下面的代码
服务器端:
Socket socket = server-client conn socket
try
{
BufferedReader inFromNode = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
PrintWriter outToNode = new PrintWriter(socket.getOutputStream(), true);
String data = inFromNode.readLine().toString();
String data1 = inFromNode.readLine().toString();
String data2 = inFromNode.readLine().toString();
outToNode .println("Hi");
}
客户端:
Socket socket = server-client conn socket
try
{
BufferedReader inFromNode = new BufferedReader(new InputStreamReader(
socket.getInputStream()));
PrintWriter outToNode = new PrintWriter(socket.getOutputStream(), true);
outToNode .println("Hi");
outToNode .println("Hi");
outToNode .println("Hi");
String data = inFromNode.readLine().toString();
}
问题是客户端代码正在等待服务器的回复。我确定服务器端已发送它(我尝试在服务器端发送后放置日志并打印它们。)我在这里忽略了什么吗?代码有任何错误吗?