Peer to Peer TCP

BlitzMax Forums/BlitzMax Programming/Peer to Peer TCP

Tibit(Posted 2005) [#1]
You need one socket for each client + one for accept/listening.

So when a new client joins you create a new socket. The questions however is, how do I tell everyone this new client joined, in a peer to peer enviroment. Should the new client connect to another client, this "already connected client" sends back a reply with the ip and ports of all other clients and then I connect to each of them, one by one? (Sounds Very Slow)

Another way would be for the Client who first get contact with the "new client" to send this data to all clients already connected; he already know them peer to peer. These can now in turn connect to the new client. However I assume that would mean that each of these clients would freeze for a small moment evertime someone connects, which would be unacceptable.

Are there a simpler way to create connections with TCP? It seems to me that if a player connects to a 64player game, he must wait a very long time for TCPConnect on each and every client, just so that we have the direct peer to peer option.

Any ideas or links?


deps(Posted 2005) [#2]
Tricky.
I would probably go with method one, it may be slow but it sounds to me that it's the only solution.


Tibit(Posted 2005) [#3]
Does anyone knows how GNet does it? It is Peer to Peer isn't it?


deps(Posted 2005) [#4]
Gnet is server/client, one of the connected players is acting as a server behind the scenes and responsible for broadcasting all changes to a TGNetObject.
At least that's how I understand it.


Tibit(Posted 2005) [#5]
I'm sure I read "you can connect several GNet Hosts.."

Any reason why some games *thinks battlefield* uses several ports? Perhaps as much as one for each player, I assume this is for TCP traffic, but what would I gain by using more ports?