eleal 0 Newbie Poster

I've got two threads running, one of them executes the following piece of code (it reads and writes to a socket):

while ((fromServer = in.readLine()) != null) {
            System.out.println(fromServer);
		    
            fromUser = stdIn.readLine();
	    if (fromUser != null) {
                out.println(fromUser);
	    } else{
		break;
	    }
        }

where in and out are BufferedReader and PrintWriter to a socket.

The second thread just writes to the same socket:

while ( !Thread.interrupted() ) {
		    out.println( allusers.allMsgs2String( login ) );
		}

I intend that both threads write to the same socket ( I don't need to synchronize them, just that when one thread makes a writing operation on the socket it appears on the other side immediately), but the problem is that on the other side of the socket I need to write something to the socket in order to get the output from the second thread so the text doesn't appear immediately when the second thread writes to the socket.