Gwupe.Communication.P2P.RUDP.Tunnel.Transport.TCPTransport.OpenConnection C# (CSharp) Method

OpenConnection() public method

public OpenConnection ( String endPoint, byte protocolId ) : ITcpOverUdptSocket
endPoint String
protocolId byte
return ITcpOverUdptSocket
        public ITcpOverUdptSocket OpenConnection(String endPoint, byte protocolId)
        {
            lock (_connectLock)
            {
                byte connectionId = GetNextConnectionId();
                // this method will send the necessary packet requesting connection, handle the response
                ITcpTransportLayer connection = _tcpConnectionHelper.ConnectNamed(connectionId, endPoint, 10000, protocolId);
                Logger.Debug("Successfully connected to service " + endPoint + " local connection [" + connectionId + "], remote connection [" + connection.RemoteConnectionId + "]");
                // add the connection to our list of active connections
                _tcpConnections.Add(connection);
                // notify remote endpoint we are ready to accept and send data on this connection
                SendData(new StandardConnectRsAckPacket(connectionId));
                // set it up to tie up loose ends when the connection dies
                connection.ConnectionClose += ConnectionOnConnectionClose;
                // notify the connection it can start
                connection.Open();
                // return the socket to upstream so it can start reading/writing
                return connection.Socket;
            }
        }

Same methods

TCPTransport::OpenConnection ( string endPoint ) : ITcpOverUdptSocket