0

Not really sure how to title this question so here it goes.

I am trying to determine if it is possible to setup a client/server and have the server just handle requests (easy). But the hard part is I want to see if it is possible to have two clients talk to the server and the server then gives the clients each others sockets allowing them to talk directly to each other.

Client1----| | ---Server Client2----| 

So both clients would initially start talking to the server, then the server would return to each client the other persons socket. Which at the moment is not possible because they are not serialized. Is there a way to pass something back to the clients to allow them to bypass opening ports for client to client communication?

7
  • what are your findings so far about the described problem? Commented Jun 17, 2018 at 17:52
  • The main issue is that you cannot serialize sockets. And since ServerSocket is the one that actually creates the socket I dont know of a good way to overwrite the socket with my own implementation. Not sure how to acomplish this.... Commented Jun 17, 2018 at 18:31
  • 4
    Why would you ever want to serialize Sockets? Makes no sense. Instead you need to hook up two clients. Please look at this similar question Commented Jun 17, 2018 at 18:37
  • Also look at these similar questions Commented Jun 17, 2018 at 18:37
  • 2
    TCP is point-to-point. So no, the clients need to establish a new connection with each other, with all the difficulties of getting through NAT etc. But the server can help by telling the client it's "external" IP. So only the port needs to be opened, e.g. via upnp. Commented Jun 17, 2018 at 18:37

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.