• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reg. Applet Chat

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I have developed 2 programs
(1) Server.java (Normal Java Program with port no. say 1001)
(2) Client.java (Which binds to the server at the port no. 1001) - Applet File , with lots of option of paint, chat

Execution mode :
Server.java executed once
Client.java - in one cmd prompt Say Client 'A'
Client.java - seperate window Say Client 'B'
Client.java - seperate window Say Client 'C'
Client.java - seperate window Say Client 'D'

Whatever A types reflect in all the rest of the clients 'B','C','D'.

But i would like to do a privacy chat between 'A' - 'B' and 'C' - 'D'.

Will i need to create another server with diff port.. If yes, assume if i want to provide 1000 privacy chat between the users.. then?

One more Ques : If i want to create many server programs with diff port number during runtime, how can i check whether the port is already running or not?

Awaiting for earliest reply
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Having a single ServerSocket should be sufficient. Each client should indicate somehow to which other clients its messages should be sent; the server then should honor that.

If you try to open a ServerSocket on a port that's already is use, an exception will be thrown.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic