• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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.
 
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic