This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Client and Server using TCP  RSS feed

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Now I am creating single application using TCP and UDP Sockets. I have doubt on this, Actually, I am sending a file using UDP Multicasting. If three clients are receiving that file. I need to find receive missing packets by using TCP from all clients. I can do this. But how can I break this loop

while(true)
{
theclient = serverSocket.accept();
receiveMissingPackArray = new ReceiveMissingPackArray(clientNo,theclient,no_of_packets);
}

once all the missing packets are received. I have some question.
1) How to find number of clients connected to server.
2) How to find stil clients are connectd to server or not.

If any one help on this, which will be very useful for me.
Thanks in Advance.
-Prabhakaran
 
Ranch Hand
Posts: 152
Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
create a new Thread for each client you accept, pass the client socket (Socket)
to that Thread and have the Thread doing all the work.

The server then is free to continue listening and accepting the next client.

Or in short: write a client handler

Hope that helps
Matt
 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Matt. Its little bit working. I am tuning it further based on my application.

Thanks again.
-Prabhakaran
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!