Note that there are some explanatory texts on larger screens.

plurals
  1. POConnect two TCP sockets without defining client/server role
    primarykey
    data
    text
    <h2>Question</h2> <p>I want to connect two processes via TCP but I don't want have to specify which of them is the server and which is the client but they know the IP and host of each other. They should decide on their own which is the server and which is the client and then initiating the connection. </p> <h2>Background</h2> <p>I am working on a bidirectional distributed framework where - in contrast to RPC - there is no client/server model. Instead the distributed components should just be able to talk to each other by specifying a host and port.</p> <p><em>Edit:</em> The concept goes beyond the implementation details of a socket connection. This should be a new concept to simplify designing a distributed application in terms of <a href="http://en.wikipedia.org/wiki/Software_engineering" rel="noreferrer">software engineering</a>. This is in contrast to RPC and SOA (which are Server/Client oriented) and message oriented systems (which demand the usage of IMO un-intuitive patterns). </p> <h2>The solution must not</h2> <ul> <li>defining a protocol via UDP, because I need the TCP reliability and the possibility of SSL usage</li> <li>using a framework like ZeroMQ, because I cannot use binary packages on my target platform</li> <li><em>edit</em>: a global message broker / name server because it should be a lightweight solution without an additional process. And adding such a node will just reintroduce the client/server concept</li> </ul> <h2>Update</h2> <p>After the discussion there seems only one useful approach: Every peer need to have a listing socket (or you cannot do any auto-discovery of course). On a connection request the node will try to connect to the other peer if there isn't already an open connection.</p> <p>This could be problematic if the connection is done simultaneous, so we will end up with two connections between two peers. The question is now how to deal with that in an async context. I don't think this is as easy as said below in comments because we need to guarantee that only one connection is closed. I think a protocol like 2PC is needed for this task.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload