I want to connect two clients (via TCP / IP sockets). Clients can discover each other using an intermediate server. When clients discover each other, there should be no server involvement.
I studied this and found many people offering JXTA . But I would like to create the protocol myself from scratch (because in the future I may have to implement the same with WebSockets (when my client is a browser)). Currently, my clients may be desktop applications or mobile applications.
My questions:
How will clients discover each other on the server? If the server sends the global IP address of the clients to each other, will this information be sufficient to create a peer-to-peer connection? What if clients are on the same LAN and the server is on another wide area network?
The client has a dynamic IP address. Can their IP change suddenly, even if it has an active socket?
Is a peer-to-peer connection reliable for transmitting non-continuous data (for example, in a chat application)?
[NOTE: by peer-to-peer, I mean establishing a TCP / IP socket connection to the client server (using Java), making one of the clients a temporary socket server]
Thanks in advance.
source share