I have TCP client/server. Client is running two thread C1 and C2. And server is running three threads S1, S2, and S3 threads. C2 should receive results after server finishes S3. I have problem in the last step. The client and server look like this. Please suggest.
Public class client {
public static void main (String[] args)
{
ClientThread c1= new ClientThread(); // send task to server
ClientThread c2= new ClientThread(); // result receive
c1.start();
c1.join();
c2.start();
c2.join();
}
}
Server looks like this:
Public class server {
public static void main (String[] args)
{
ServerThread s1= new ServerThread(); // receive from client
ServerThread s2= new serverThread(); // calculate
ServerThread s3= new serverThread(); // send to client
s1.start();
s1.join();
s2.start();
s2.join();
s3.start();
s3.join();
}
}
The order of the output should look like this:
c1 sends task
s1 receives task
s2 calculates
s3 sends result to client
c2 receives final result