In order to learn better regards between protocols TCP/IP and Socket, I solved make a simple web chat (desktop). I need to knows how many users are connected to socket, so I thought in store objects sockets in a ArrayList<Socket> in then return object socket for RMI. That's the better idea to that ? Other issue: How do I send the message to particular socket connected ?
Can someone me give advice ? Thank you!
Sachin H. Gupta
posted 4 years ago
I need to knows how many users are connected to socket
Does that mean "How many users are online ?". Since you have maintained list of connected sockets in Arraylist<Socket> you can easily determine that.
How do I send the message to particular socket connected ?
You need to get an OutputStream on that Socket and send your messages using that.