Otp.AbstractConnection.AbstractConnection C# (CSharp) Method

AbstractConnection() protected method

protected AbstractConnection ( OtpLocalNode self, System s ) : System
self OtpLocalNode
s System
return System
        protected internal AbstractConnection(OtpLocalNode self, System.Net.Sockets.TcpClient s)
            : this(self, new OtpPeer(), s, null)
        {
            this.socket.NoDelay = true;
            // Use keepalive timer
            this.socket.Client.SetSocketOption(
                System.Net.Sockets.SocketOptionLevel.Socket,
                System.Net.Sockets.SocketOptionName.KeepAlive, true);
            // Close socket gracefully
            this.socket.Client.SetSocketOption(
                System.Net.Sockets.SocketOptionLevel.Socket,
                System.Net.Sockets.SocketOptionName.DontLinger, true);

            //this.socket.ReceiveTimeout = 5000;

            if (traceLevel >= OtpTrace.Type.handshakeThreshold)
            {
                OtpTrace.TraceEvent("<- ACCEPT FROM " + 
                    System.Net.IPAddress.Parse(s.Client.RemoteEndPoint.ToString()).ToString() + ":" +
                    (s.Client.RemoteEndPoint as System.Net.IPEndPoint).Port.ToString());
            }
            
            // get his info
            recvName(this.peer);
            
            // now find highest common dist value
            if ((peer._proto != self._proto) || (self._distHigh < peer._distLow) || (self._distLow > peer._distHigh))
            {
                close();
                throw new System.IO.IOException("No common protocol found - cannot accept connection");
            }
            // highest common version: min(peer.distHigh, self.distHigh)
            peer.distChoose = (peer._distHigh > self._distHigh?self._distHigh:peer._distHigh);
            
            doAccept();
            this.name = peer.node();
        }
        

Same methods

AbstractConnection::AbstractConnection ( ) : System
AbstractConnection::AbstractConnection ( OtpLocalNode self, OtpPeer other ) : System
AbstractConnection::AbstractConnection ( OtpLocalNode self, OtpPeer peer, System s, string cookie ) : System
AbstractConnection::AbstractConnection ( OtpLocalNode self, OtpPeer other, string cookie ) : System