This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

client server programming which supports both TCP and UDP

 
Yafet Negussie
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm very new for client server programming. I have a project which requires me to simulate client server programming which simulates multiple clients (at most 10) and a single server.
My question is ...
1. Is it possible to create one program that supports both client and server? I assume I have to do some sort of multithreading (I've been doing some reading). I would appreciate if someone gives me some guidance to start this program.

Thank you in advance
Yafet
 
Tim Moores
Saloon Keeper
Posts: 3266
55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not mix the client and the server within the same code. They're separate when deployed, and should be so even in your example code. You can find an extensive tutorial about Java networking at http://docs.oracle.com/javase/tutorial/networking/index.html; the "All about Sockets" chapter has a pair of client/server codes that you can study. The "All About Datagrams" chapter talks about UDP.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!