I have a problem like two clients should be accessing my web application.
My first question is how can i know that two clients exist.

If two clients exist i should have a communication as mentioned below.

Client1 should write
once client1 writes then client2 should read it and will respond
once client2 writes then client1 should read it and will respond
in this pattern my communication should happen.

Any help will be appreciated...Thanks in advance