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

[1362 byte] By [calvino_inda] at [2007-11-27 1:07:42]
# 1
Type something at the netcat console. You have a misunderstanding of what netcat does. It isn't an echo server.
ejpa at 2007-7-11 23:42:59 > top of Java-index,Java Essentials,Java Programming...
# 2
i noticed that when i type into the netcat shell, the "readLine" reads it ; i just thought that whatever the way you send bytes to the stream, it could be instantly read but it seems noti will look further on echo , thanks for the help :)
calvino_inda at 2007-7-11 23:42:59 > top of Java-index,Java Essentials,Java Programming...
# 3
An echo server returns everything you send it. netcat sends everything you type in, and types everything it receives.
ejpa at 2007-7-11 23:42:59 > top of Java-index,Java Essentials,Java Programming...