Ejemplo n.º 1
0
        private void BurrowProc()
        {
            IPEndPoint privateEndPoint = this.m_toEndPoint.m_privateEndPoint;
            IPEndPoint publicEndPoint  = this.m_toEndPoint.m_publicEndPoint;

            for (int i = 0; i < 10; i++)
            {
                this.SendData("\u0001\a\a\u0001", privateEndPoint);
                this.SendData("\u0001\a\a\u0001", publicEndPoint);
                for (int j = 0; j < 10; j++)
                {
                    if (this.m_bRecvAck)
                    {
                        this.m_bRecvAck = false;
                        this.SendData("\u0001\a\a\u0001", privateEndPoint);
                        Thread.Sleep(50);
                        this.SendData("\u0001\a\a\u0001", publicEndPoint);
                        UDPSockEventArgs uDPSockEventArgs = new UDPSockEventArgs("");
                        uDPSockEventArgs.RemoteEndPoint = publicEndPoint;
                        if (this.OnNewConnectU != null)
                        {
                            this.OnNewConnectU(this, uDPSockEventArgs);
                        }
                        return;
                    }
                    Thread.Sleep(100);
                }
                Thread.Sleep(100);
            }
            throw new Exception("打洞失败!");
        }
Ejemplo n.º 2
0
        private void RaiseMessageEvent(string strMsg)
        {
            UDPSockEventArgs uDPSockEventArgs = new UDPSockEventArgs("");

            uDPSockEventArgs.SockMessage    = strMsg;
            uDPSockEventArgs.RemoteEndPoint = this.m_remotePoint;
            if (this.OnSockMessageU != null)
            {
                this.OnSockMessageU(this, uDPSockEventArgs);
            }
        }
Ejemplo n.º 3
0
        private void ReceiveName(string strCmd, int nPos)
        {
            int num = strCmd.IndexOf("\u0002\u0001");

            if (num == -1)
            {
                return;
            }
            this.m_sbResponse.Remove(nPos, num - nPos + 2);
            string           remoteUserName   = strCmd.Substring(nPos + 2, num - nPos - 2);
            UDPSockEventArgs uDPSockEventArgs = new UDPSockEventArgs("");

            uDPSockEventArgs.RemoteUserName = remoteUserName;
            uDPSockEventArgs.RemoteEndPoint = this.m_remotePoint;
            if (this.OnUserLogInU != null)
            {
                this.OnUserLogInU(this, uDPSockEventArgs);
            }
        }