You have to flush the stream on the server if you want to see the results immediately. The stream is auto-flushed on close() that's why you seen the output then.
You have to flush the stream on the server if you want to see the results immediately. The stream is auto-flushed on close(), that's why you seen the output then.
– Ken Sep 27 at 12:43 Yes, after out. Write – michael667 Sep 27 at 12:45 Well, now its reading, but it still returns null :S – Ken Sep 27 at 12:47 Nevermind- it returns null because the client hasn't written anything xD – Ken Sep 27 at 12:49.
At first glance, it looks like your call to in.readLine() is blocking because it hasn't encountered a newline yet. Thus, it blocks until your connection drops. Try BufferedReader's read method: public int read(char cbuf, int off, int len) and pass in a fixed length array such as: char cbuf = new char1024; Use the return value of the read call to see how many bytes were in the last read (0-1024) if you read 1024, there is likely more to read.
If you read 0, then there is likely no more to read.
You are reading lines but you aren't writing them. Write() doesn't write a newline, and readLine() blocks until it receives one.
It is server side Code for accepting String From Client but according to my code you will have use DataInputStream and DataOutputStream instead of PrintWriter And BufferedReader. This code is Completely Working for One to One Client.. In code "jta" is JTextArea .. soc = server.accept(); while(true) { String data=""; try { dis = new DataInputStream(soc.getInputStream()); dos = new DataOutputStream(soc.getOutputStream()); data = dis.readUTF(); } catch(Exception e) { } jta. Append(data + "\n"); }.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.