This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes client server programming which supports both TCP and UDP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "client server programming which supports both TCP and UDP" Watch "client server programming which supports both TCP and UDP" New topic
Author

client server programming which supports both TCP and UDP

Yafet Negussie
Greenhorn

Joined: Mar 17, 2012
Posts: 4
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
Rancher

Joined: Sep 21, 2011
Posts: 2407
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.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: client server programming which supports both TCP and UDP
 
Similar Threads
client program issue
Client Server -- same socket
MIDP Networking questions
JavaScript window close event...
socket programming using servlet