This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes How to count the number of client machines connected to server machine in java using socket communic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "How to count the number of client machines connected to server machine in java using socket communic" Watch "How to count the number of client machines connected to server machine in java using socket communic" New topic
Author

How to count the number of client machines connected to server machine in java using socket communic

Riyas Hameed
Ranch Hand

Joined: Jan 07, 2012
Posts: 33


Hi All,

Iam working on stand alone application in java using socket communication,
Almost 200 cleint machines will transfer files to server system . how to find the number of client machines is connected with server. please advise me , Iam new to netwroking concept.
please correct me if I am wrong.
Thanks in Advance.
chenna kesava.ich
Greenhorn

Joined: Feb 01, 2012
Posts: 1
Riyas Hameed wrote:


Hi All,

Iam working on stand alone application in java using socket communication,
Almost 200 cleint machines will transfer files to server system . how to find the number of client machines is connected with server. please advise me , Iam new to netwroking concept.
please correct me if I am wrong.
Thanks in Advance.


Are you asking for machines connected to server at that instant or total no. of connections after server started ?
Riyas Hameed
Ranch Hand

Joined: Jan 07, 2012
Posts: 33
chenna kesava.ich wrote:
Riyas Hameed wrote:


Hi All,

Iam working on stand alone application in java using socket communication,
Almost 200 cleint machines will transfer files to server system . how to find the number of client machines is connected with server. please advise me , Iam new to netwroking concept.
please correct me if I am wrong.
Thanks in Advance.


Are you asking for machines connected to server at that instant or total no. of connections after server started ?


Thanks for your response .
for example my client program have installed in 100 machines , all these client machines are connected to server , due to some problem some of the client machines are not connected with server while running , how do you I know what are the client machines not connected with server also I want to count the number of machines connected with server .
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Riyas, please don't quote your own posts. That isn't what the quoting feature is for and it just makes it confusing for everybody else. I've edited your posts to unquote them.

As for your question (or at least one version of it): Use an int variable. When a client connects to your server, increment that variable. When a client disconnects, decrement it.
Riyas Hameed
Ranch Hand

Joined: Jan 07, 2012
Posts: 33
Paul Clapham wrote:Riyas, please don't quote your own posts. That isn't what the quoting feature is for and it just makes it confusing for everybody else. I've edited your posts to unquote them. As for your question (or at least one version of it): Use an int variable. When a client connects to your server, increment that variable. When a client disconnects, decrement it.




Thanks Paul, here after it wont happen
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to count the number of client machines connected to server machine in java using socket communic
 
Similar Threads
Problem in communication bet'n vb client and java server
bring RMI and sockets
Send messages to clients selectively?
java.net Socket port number question
Doubt abt Socket