1. I have to program a server which can listen multiple clients on a single port (say 8080).
2. Once connection is established with a client, communication starts between client and server. Client sends - Server Receives, then Server sends - Client receives.
3. If multiple Clients are connected to server at a time on the port 8080, all clients should receive data simultaneously.
Ok, I have done the points 1 and 2. i understand some basics of Socket Programming / TCP/IP Programming. I have created a TCPListener object which keeps in listen mode, and whenever a client connects, it accepts it and create a thread to receive its data and send data to that client.
The problem is when i connect two clients, then the one starts receiving and other client just receive data for one or two time, and then gives an exception -
"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."
Why this is happening?
is there something i am missing or doing wrong.
I think there is something wrong in Threading part.
Thanks in advance.