Пример #1
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) || ip == "127.0.0.1")
                {
                    RConConnection nC = new RConConnection(socket);
                }
                else
                {
                    socket.Close();
                }
            }
            catch (Exception) { }

            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) || ip == "127.0.0.1")
                {
                    RConConnection nC = new RConConnection(socket);
                }
                    else
                {
                    socket.Close();
                }
            }
            catch (Exception) { }

            msSocket.BeginAccept(OnEvent_NewConnection, msSocket);
        }