// Portion of code copied from the senders side
clientSocket = new Socket(successor.IP, successor.PORT);
toServer = new BufferedWriter(new OutputStreamWriter(clientSocket.getOutputStream()));
String message = "deleteme\n"+predecessor.IP+","+predecessor.PORT;
toServer.write(message);
toServer.newLine();
toServer.flush();
// Portion of code copied from the receivers side
fromClient = new BufferedReader(new InputStreamReader(socket.getInputStream()));
toClient = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
input = fromClient.readLine();
在接收方,deleteme
之前有奇怪的字符。像俱乐部♣
一样。
我想知道这些角色来自哪里以及如何解决问题?我正在做的临时修复是在发送deleteme
消息之前,我发送了一些垃圾数据,如abcd
。然后deleteme就到了那里。