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
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.
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.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads