InitSocket() private method

private InitSocket ( Socket socket ) : void
socket Socket
return void
Example #1
0
        public static ITcpConnection CreateAcceptedTcpConnection(Guid connectionId, IPEndPoint remoteEndPoint, Socket socket, bool verbose)
        {
            var connection = new TcpConnection(connectionId, remoteEndPoint, verbose);

            connection.InitSocket(socket);
            return(connection);
        }
Example #2
0
        internal static TcpConnection CreateAcceptedTcpConnection(IPEndPoint effectiveEndPoint, Socket socket)
        {
            var connection = new TcpConnection(effectiveEndPoint);

            connection.InitSocket(socket);
            return(connection);
        }
Example #3
0
        public static ITcpConnection CreateConnectingTcpConnection(Guid connectionId,
                                                                   IPEndPoint remoteEndPoint,
                                                                   TcpClientConnector connector,
                                                                   TimeSpan connectionTimeout,
                                                                   Action <ITcpConnection> onConnectionEstablished,
                                                                   Action <ITcpConnection, SocketError> onConnectionFailed,
                                                                   bool verbose)
        {
            var connection = new TcpConnection(connectionId, remoteEndPoint, verbose);

// ReSharper disable ImplicitlyCapturedClosure
            connector.InitConnect(remoteEndPoint,
                                  (_, socket) =>
            {
                connection.InitSocket(socket);
                if (onConnectionEstablished != null)
                {
                    onConnectionEstablished(connection);
                }
            },
                                  (_, socketError) =>
            {
                if (onConnectionFailed != null)
                {
                    onConnectionFailed(connection, socketError);
                }
            }, connection, connectionTimeout);
// ReSharper restore ImplicitlyCapturedClosure
            return(connection);
        }
Example #4
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);
        }
        public static ITcpConnection CreateConnectingTcpConnection(Guid connectionId, 
                                                                   IPEndPoint remoteEndPoint, 
                                                                   TcpClientConnector connector, 
                                                                   TimeSpan connectionTimeout,
                                                                   Action<ITcpConnection> onConnectionEstablished, 
                                                                   Action<ITcpConnection, SocketError> onConnectionFailed,
                                                                   bool verbose)
        {
            var connection = new TcpConnection(connectionId, remoteEndPoint, verbose);
// ReSharper disable ImplicitlyCapturedClosure
            connector.InitConnect(remoteEndPoint,
                                  (_, socket) =>
                                  {
                                      connection.InitSocket(socket);
                                      if (onConnectionEstablished != null)
                                          onConnectionEstablished(connection);
                                  },
                                  (_, socketError) =>
                                  {
                                      if (onConnectionFailed != null)
                                          onConnectionFailed(connection, socketError);
                                  }, connection, connectionTimeout);
// ReSharper restore ImplicitlyCapturedClosure
            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;
 }
 internal static TcpConnection CreateAcceptedTcpConnection(IPEndPoint effectiveEndPoint, Socket socket)
 {
     var connection = new TcpConnection(effectiveEndPoint);
     connection.InitSocket(socket);
     return connection;
 }
Example #8
0
 public static ITcpConnection CreateAcceptedTcpConnection(Guid connectionId, IPEndPoint remoteEndPoint, Socket socket, bool verbose)
 {
     var connection = new TcpConnection(connectionId, remoteEndPoint, verbose);
     connection.InitSocket(socket);
     return connection;
 }