A.3. Connection Creation Process

The connection creation process uses the reliable TCP protocol. After the TCP connection has been successfully created, both sides exchange also UDP port number in order to know where to send UDP packets to.

Table A.1. Process of the successful connection creation
Connection acceptor - ServerConnection initiator - Client
Listens on a well known port 
  Initiates a TCP connection to the server's well known port (configurable in configuration files).
Accepts the connection and sends SERVER_PORT_MESSAGE with the server's NodeId 
  Receives the SERVER_PORT_MESSAGE with the server's NodeId and sends the NODE_ID_MESSAGE with the client's NodeId.
Receives NODE_ID_MESSAGE, generates blowfish ciphre and sends RSA-encrypted BLOWFISH_KEY_MESSAGE 
  Receives, verifies and decrypts the BLOWFISH_KEY_MESSAGE and sends back RSA-encrypted KEY_CONFIRMATION_MESSAGE
Receives, verifies and decrypts the KEY_CONFIRMATION_MESSAGE, creates a UDP socket and sends UDP_PORT_MESSAGE containing the port number that should be used for sending UDP messages to this node.  
 Receives the UDP_PORT_MESSAGE with the server's UDP port and sends back empty UDP_CONNECT_MESSAGE. The connection has been created.
Receives the empty TCP_CONNECT_MESSAGE. Sends back the empty TCP_CONFIRMATION_MESSAGE. The connection has been created and confirmed.  
 Receives the empty TCP_CONFIRMATION_MESSAGE. The connection has been confirmed too.

After the synchronnous TCP connection creation process begins the asynchronous UDP setup procedure - server ( in the meaning of connection acceptor ) must get informed about the client's ( initiator's ) UDP port. Every second the client sends the UDP_INIT_MESSAGE to the server's UDP port until it receives the TCP UDP_HANDSHAKE_MESSAGE from the server.