• 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

chat program

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can i connect multiple clients to a single port of
a server?When one client is connected to the port the other client does not get reply from the server?
How can this be made possible?
thanks in advance
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, from what I know you can't have multiple client's connected to the same socket port. What you can do is have the server program "listening" on the specific port and when a request comes in it will spawn some processes to handle the request, and then go back to listening for new requests.
A quick thought about a possible implementation of this :
---------------------------------------------------------
What I would do is implement A ChatServer object, A ChatSession object, and ChatWindow objects. The ChatServer would listen on the specifiec port for incomming chat requests. When the request is received, the ChatServer determines if this is a new ChatSession request, or a request to join an on going ChatSession. If it's an existing ChatSession object, spawn a new ChatWindow object, register this window as a listener to the ChatSession. The ChatSession would notify all its listeners whenever a message came in from one of it's ChatWindows, and push the new data to them.
------------------------------------------------------------
 
reply
    Bookmark Topic Watch Topic
  • New Topic