This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Using sockets to store how many users connected. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Using sockets to store how many users connected." Watch "Using sockets to store how many users connected." New topic
Author

Using sockets to store how many users connected.

Gustavo Siqueira
Ranch Hand

Joined: Jun 15, 2011
Posts: 97

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
Greenhorn

Joined: Oct 10, 2012
Posts: 17
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using sockets to store how many users connected.