Пример #1
0
 public SocketController(SecureSocket parent, Socket socket, SecurityOptions options)
 {
     m_Parent          = parent;
     m_Socket          = socket;
     m_IsDisposed      = false;
     m_ActiveSend      = null;
     m_ActiveReceive   = null;
     m_DecryptedBuffer = new XBuffer();
     m_ToSendList      = new ArrayList(2);
     m_SentList        = new ArrayList(2);
     m_ReceiveBuffer   = new byte[m_ReceiveBufferLength];
     m_Compatibility   = new CompatibilityLayer(this, options);
     //			m_RecordLayer = new RecordLayer(this, options);
     try {
         m_Socket.BeginReceive(m_ReceiveBuffer, 0, m_ReceiveBufferLength, SocketFlags.None, new AsyncCallback(this.OnReceive), null);
     } catch (Exception e) {
         CloseConnection(e);
     }
     if (options.Entity == ConnectionEnd.Client)
     {
         //				byte[] hello = m_RecordLayer.GetControlBytes(ControlType.ClientHello);
         byte[] hello = m_Compatibility.GetClientHello();
         BeginSend(hello, 0, hello.Length, null, DataType.ProtocolData);
     }
 }
Пример #2
0
		public SocketController(SecureSocket parent, Socket socket, SecurityOptions options) {
			m_Parent = parent;
			m_Socket = socket;
			m_IsDisposed = false;
			m_ActiveSend = null;
			m_ActiveReceive = null;
			m_DecryptedBuffer = new XBuffer();
			m_ToSendList = new ArrayList(2);
			m_SentList = new ArrayList(2);
			m_ReceiveBuffer = new byte[m_ReceiveBufferLength];
			m_Compatibility = new CompatibilityLayer(this, options);
			//			m_RecordLayer = new RecordLayer(this, options);
			try {
				m_Socket.BeginReceive(m_ReceiveBuffer, 0, m_ReceiveBufferLength, SocketFlags.None, new AsyncCallback(this.OnReceive), null);
			} catch (Exception e) {
				CloseConnection(e);
			}
			if (options.Entity == ConnectionEnd.Client) {
				//				byte[] hello = m_RecordLayer.GetControlBytes(ControlType.ClientHello);
				byte[] hello = m_Compatibility.GetClientHello();
				BeginSend(hello, 0, hello.Length, null, DataType.ProtocolData);
			}
		}
Пример #3
0
        public SocketController(SecureSocket parent, Socket socket, SecurityOptions options)
        {
            this.m_Parent = parent;
            this.m_Socket = socket;
            this.m_IsDisposed = false;
            this.m_ActiveSend = null;
            this.m_ActiveReceive = null;
            this.m_DecryptedBuffer = new XBuffer();
            this.m_ToSendList = new ArrayList(2);
            this.m_SentList = new ArrayList(2);
            this.m_ReceiveBuffer = new byte[m_ReceiveBufferLength];
            this.m_End = options.Entity;

            this.OnConnectionClose += parent.ConnectionCloseHandler;

            this.m_Compatibility = new CompatibilityLayer(this, options);
        }