示例#1
0
        internal void OnEvent_NewConnection(IAsyncResult iAr)
        {
            try
            {
                Socket        socket = ((Socket)iAr.AsyncState).EndAccept(iAr);
                MusConnection nC     = new MusConnection(socket);
            }
            catch { }

            msSocket.BeginAccept(OnEvent_NewConnection, msSocket);
        }
示例#2
0
        internal void OnEvent_NewConnection(IAsyncResult iAr)
        {
            try
            {
                Socket socket = ((Socket)iAr.AsyncState).EndAccept(iAr);
                String ip     = socket.RemoteEndPoint.ToString().Split(':')[0];

                if (allowedIps.Contains(ip))
                {
                    MusConnection nC = new MusConnection(socket);
                }
                else
                {
                    socket.Close();
                }
            }
            catch (Exception) { }

            msSocket.BeginAccept(OnEvent_NewConnection, msSocket);
        }
示例#3
0
文件: MusSocket.cs 项目: habb0/Bfly
        internal void OnEvent_NewConnection(IAsyncResult iAr)
        {
            try
            {
                Socket socket = ((Socket)iAr.AsyncState).EndAccept(iAr);
                String ip = socket.RemoteEndPoint.ToString().Split(':')[0];

                if (allowedIps.Contains(ip))
                {
                    MusConnection nC = new MusConnection(socket);
                }
                else
                {
                    socket.Close();
                }
            }
            catch (Exception) { }

            msSocket.BeginAccept(OnEvent_NewConnection, msSocket);
        }