The setting: I want to write a point-to-point Connection class that, when used, does not differentiate between server and client. The first host wh
Connection
As Jon and Andrew said you can't see if a listener is open, but you can implement a ping/pong protocol. Send a ping first time you connect if no pong back then set this up like a server. If you got pong back then that's your server.