I am currently working on a server-client communication. On server-side, I have a Thread listening continuously for any incoming data from the client.
while ((foo = (Foo) objectInputSteam.readObject()) != null) {...}
Sometimes I also need to send data from the server to the client. (Not as a direct response.) After sending some data to the client over the same socket, an exception will be thrown once new data reaches the server (0xAC). As far as I know, this happens because the inputreader is reading while sending data over the same socket. Is there any way to interrupt the listening thread while sending the data to the client or do I need to create a second socket on a different port for outgoing traffic?