First of all, I'm writing a really simple 1 on 1 chatting program thing using
java.net.Socket and reading each other's messages by
using
writeUTF() and
readUTF() of
java.io.DataOutputStream and
java.io.DataInputStream. Thing is, I wanna write a
thread for
both sides to continuously read from their respective socket's input streams while ignoring the lack of data coming through like when one
user is not sending a message or something. I've written a dumbed down version of this that only reads one message from only one side
and another one that sends a file, both of which work fine, I guess.
I'm using
java.util.Scanner for user input, if that's acceptable, for I am not too familiar with
Java's other readers. Also, I just started
teaching myself about
java.net.Socket, so I may not be too familiar other than the basics like how to set up a connection and how
to send data using the
getOutputStream() member function and stuff like that.
Thank you~