I need to write a java program handle two sockect connection A ,B .
So, in normal case ,one connection , the program will read data from connection and process it .
Then read data from connection again and process it .
Work like a while loop .
But if I need to handle two socket connection ,how can I write in one program .
Apart from read data from A ,process it , then read data from B , process it .
work like A ,B ,A,B sequential .
Any other method I can write in this program to handle two connection.
As, it is not promised that there are data in the connection , sometime there are no data in the message queue of the two connection .
Please advice ...