How to communicate asynchronously with client/server?
Hi, I've been working on a client/server project based off of the KnockKnock Server/Client example (multiclient one) and I'm wondering how I can make it so that both sides don't wait around for input before doing anything else. Currently, since I've followed the example and done something likewhile((inputLine=in.readLine())!=null){
/*do other stuff*/
}
this causes both sides to wait until receiving something before sending something. This is not a good way for my program to run. How can I change it so that it doesn't wait on the input before continuing in the loop? I tried doing something like
while(running){
inputLine=in.readline();
if(inputLine!=null)//process input
/*do other stuff*/
}
but this still waits on the input part. Any ideas? Not sure if asynchronously is the right word, but I think it covers the right idea.
Oh, I saw something about using two sockets while searching some more on google. How effective would that be?
Message was edited by:
iofthestorm

