Hello again.
I’m almost done with my server - client implementation. I have one thread to read and accept connections, and another that sends data to clients. When connection is accepted, it’s channel is added to clients Set:
public static Set clients_set = Collections.synchronizedSet(new HashSet());
The problem is when more then one client connects, my sender thread is looping through set’s iterator (and I tested, it really is looping through it), only single connection receives data. I’m using windows telnet to test it, server is listening on port 23. First client that connects normally receives test data every second. But when more clients connect they in 80% of cases don’t receive anything, and in other 20% they start to receive data but client that received data before them stops receiving. So there is only one client that receives the data at a time. Can someone tell me why? ???
They all connect to same port (for telnet): 23. Can I have multiple connections on same port? I think so.