can't read in a socket
hi, everyone
i launched netcat with 'nc -lp 1255' on my computer and then tried to execute the following code:
publicstaticvoid main(String [] args){
try{
Socket s =new Socket("127.0.0.1", 1255);
BufferedReader reader =new BufferedReader(new InputStreamReader(s.getInputStream()));
PrintWriter writer =new PrintWriter(new OutputStreamWriter(s.getOutputStream()));
writer.println("test");
writer.flush();
System.out.println(reader.readLine());
}catch (Exception e){ e.printStackTrace();}
}
I saw the "test" message appear in the netcat shell, but neither the readLine() read anything, nor an exception was thrown
I don't understand why
Any help would be greatly appreciated !
Message was edited by:
calvino_ind

