Tech Off Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Question Re: Server Communication

Back to Forum: Tech Off
  • User profile image

    hi guys,

    I have a question regarding the server communication. Its a seemingly simple problem but i am not sure how to approach it.

    Consider the following:

    1) You have 10 + servers that need to register itself in a db

    2) each server has to establish "ONE" connection with the others but not including itself (no loop back)

    the problem is, how do you synchronize which one listens for the others, and which ones initiate the connection to the others?

    The current setup is that all servers listen for connections from given ips, and also have a connection socket, that would connect it to all others except self. this would result in the establishment of repeated connections to the same server (one as a result of listening, and one as a result of connecting).

    I want each server to have one connection to a given server.

    I thought about doing it the the later way, but hold each connection to a hash table, and then loop through each one, and if there are repeats just shutdown the socket and dispose it. However this will result in a problem. how does both servers know that they want to shutdownt socket1 (resulting in Server2 connecting to server2) connection, and not socket2 (resulting from server 1 listening to server2). What if server 1 shutsdown socket 2, and server 2 shutsdown socket 1 ((thinking that the other would do the exact samething)) but end up closing all live connections between them.

    So what is an easy way to solve this? Allocate Male and female servers? (male would not listen, just connect to all females) , (females would only listen and accept connections). Is this a good solution to the problem? or not?

    and if this is a working solution, how to automate which server acts as the male and which server acts as the female? (through startup order? but what if they start at the same time?). (And then how to establish a connection (among males)  and amongfemales?Expressionless)

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.