• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SERVER socket ---- SERVER socket

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all, I have a design. But I am not sure if it is correct.
I have two computers, each runing with SERVER Socket to receive incoming request. After it gets message, it will open another Client socket in another port to outside computer.
The tricky is , EACH computer is runing in SERVER socket mode. not the client-server mode.
This design will work?
Thanks.
Edward
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neither computers nor programs have a "server mode", per se. Many programs act as both network servers and network clients. The only complication is that you'll most likely want to use a dedicated thread for listening on the ServerSocket, so that the client activities don't block the server.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you described sounds fine. A program opens a ServerSocket that will accept connections from clients. When a client sends a message, the program acts as a client by opening a connection to another server. Happens all the time.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic