How do I make a TCP connection between 2 servers if both can start the connection ?
Posted
by DeeD
on Stack Overflow
See other posts from Stack Overflow
or by DeeD
Published on 2010-03-17T08:07:40Z
Indexed on
2010/03/17
8:11 UTC
Read the original article
Hit count: 144
I have a defined number of servers that can locally process data in their own way. But after some time I want to synchronize some states that are common on each server. My idea was that establish a TCP connection from each server to the other servers like a mesh network.
My problem is that in what order do I make the connections since there is no "master" server here, so that each server is responsible for creating there own connections to each server.
My idea was that make each server connect and if the server that is getting connected already has a connection to the connecting server, then just drop the connection.
But how do I handle the fact that 2 servers is trying to connect at the same time? Because then I get 2 TCP connections instead of 1.
Any ideas?
© Stack Overflow or respective owner