BeginInitializeConnection() private method

private BeginInitializeConnection ( string host, int port, AsyncCallback callback, object state ) : IAsyncResult
host string
port int
callback AsyncCallback
state object
return IAsyncResult
Ejemplo n.º 1
0
            private void InitializeConnection()
            {
                IAsyncResult result = _connection.BeginInitializeConnection(_host, _port, InitializeConnectionCallback, this);

                if (result.CompletedSynchronously)
                {
                    try
                    {
                        _connection.EndInitializeConnection(result);
                        if (NetEventSource.IsEnabled)
                        {
                            NetEventSource.Info(this, "Connect returned");
                        }

                        Handshake();
                    }
                    catch (Exception e)
                    {
                        InvokeCallback(e);
                    }
                }
            }
Ejemplo n.º 2
0
            private void InitializeConnection()
            {
                IAsyncResult result = _connection.BeginInitializeConnection(_host, _port, InitializeConnectionCallback, this);

                if (result.CompletedSynchronously)
                {
                    _connection.EndInitializeConnection(result);
                    if (GlobalLog.IsEnabled)
                    {
                        GlobalLog.Print("ConnectAndHandshakeAsyncResult#" + LoggingHash.HashString(this) + "::Connect returned" + LoggingHash.HashString(this));
                    }

                    try
                    {
                        Handshake();
                    }
                    catch (Exception e)
                    {
                        InvokeCallback(e);
                    }
                }
            }