Пример #1
0
        static void OnTargetListenerConnected(IAsyncResult ar)
        {
            object[]        args      = (object[])ar.AsyncState;
            SocketTransport transport = (SocketTransport)args[0];
            Socket          listener  = (Socket)args[1];

            lock (transport.mLock)
            {
                if (listener == transport.mTargetListener)
                {
                    Socket     client   = listener.EndAccept(ar);
                    IPEndPoint endpoint = (IPEndPoint)client.RemoteEndPoint;
                    HostInfo   hostInfo = new SocketHostInfo(transport, endpoint.Address.ToString(), 51337);
                    client.Close();

                    try
                    {
                        transport.DebugManager.MainWindow.Invoke(new CallbackDelegate(Callback), new object[] { transport, hostInfo });
                        listener.BeginAccept(new AsyncCallback(OnTargetListenerConnected), new object[] { transport, listener });
                    }
                    catch (InvalidOperationException)
                    {
                        // It's possible the main window hasn't finished creating here
                    }
                }
            }
        }
Пример #2
0
//		AutoResetEvent m_asyncDataAvailable;

//		ReceiveMessageBuffer m_readBuffer;
//		SendMessageBuffer m_writeBuffer;


		public SocketConnection(SocketTransport transport, SocketHostInfo info)
		{
			m_transport = transport;
			m_info = info;

			m_asyncConnect = new AutoResetEvent(false);

			m_asyncReadBuffer = new byte[512 * 1024];
//			m_asyncDataAvailable = new AutoResetEvent(false);

//			m_readBuffer = new ReceiveMessageBuffer(512 * 1024);
//			m_writeBuffer = new SendMessageBuffer(4 * 1024);
		}
Пример #3
0
//		AutoResetEvent m_asyncDataAvailable;

//		ReceiveMessageBuffer m_readBuffer;
//		SendMessageBuffer m_writeBuffer;


        public SocketConnection(SocketTransport transport, SocketHostInfo info)
        {
            m_transport = transport;
            m_info      = info;

            m_asyncConnect = new AutoResetEvent(false);

            m_asyncReadBuffer = new byte[512 * 1024];
//			m_asyncDataAvailable = new AutoResetEvent(false);

//			m_readBuffer = new ReceiveMessageBuffer(512 * 1024);
//			m_writeBuffer = new SendMessageBuffer(4 * 1024);
        }
Пример #4
0
 static void Callback(SocketTransport transport, HostInfo hostInfo)
 {
     transport.DebugManager.Disconnect(false, false);
     transport.DebugManager.Connect(hostInfo);
 }
Пример #5
0
		public SocketHostInfo(SocketTransport transport, string host, int port)
			: base(transport, host + ":" + port.ToString())
		{
			mHost = host;
			mPort = port;
		}
Пример #6
0
 public SocketHostInfo(SocketTransport transport, string host, int port)
     : base(transport, host + ":" + port.ToString())
 {
     mHost = host;
     mPort = port;
 }
Пример #7
0
		static void Callback(SocketTransport transport, HostInfo hostInfo)
		{
			transport.DebugManager.Disconnect(false, false);
			transport.DebugManager.Connect(hostInfo);
		}