TrySend() private method

private TrySend ( ) : void
return void
Exemplo n.º 1
0
        internal static TcpConnection CreateConnectingTcpConnection(IPEndPoint remoteEndPoint,
                                                                    TcpClientConnector connector,
                                                                    Action <TcpConnection> onConnectionEstablished,
                                                                    Action <TcpConnection, SocketError> onConnectionFailed)
        {
            var connection = new TcpConnection(remoteEndPoint);

            connector.InitConnect(remoteEndPoint,
                                  (_, socket) =>
            {
                connection.InitSocket(socket);
                if (onConnectionEstablished != null)
                {
                    onConnectionEstablished(connection);
                }
                connection.TrySend();
            },
                                  (_, socketError) =>
            {
                if (onConnectionFailed != null)
                {
                    onConnectionFailed(connection, socketError);
                }
            });
            return(connection);
        }
 internal static TcpConnection CreateConnectingTcpConnection(IPEndPoint remoteEndPoint, 
                                                             TcpClientConnector connector, 
                                                             Action<TcpConnection> onConnectionEstablished, 
                                                             Action<TcpConnection, SocketError> onConnectionFailed)
 {
     var connection = new TcpConnection(remoteEndPoint);
     connector.InitConnect(remoteEndPoint,
                           (_, socket) =>
                           {
                               connection.InitSocket(socket);
                               if (onConnectionEstablished != null)
                                   onConnectionEstablished(connection);
                               connection.TrySend();
                           },
                           (_, socketError) =>
                           {
                               if (onConnectionFailed != null)
                                   onConnectionFailed(connection, socketError);
                           });
     return connection;
 }