Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

client server programming which supports both TCP and UDP

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 7169
165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic