예제 #1
0
        void Accept()
        {
            if (SocketAsynPool.Count > 0)
            {
                SocketAsyncEventArgs sockasyn = SocketAsynPool.Pop();
                sockasyn.Completed += new EventHandler <SocketAsyncEventArgs>(WorkaroundCallback);


                if (!Sock.AcceptAsync(sockasyn))
                {
                    WorkaroundCallback(null, sockasyn);
                }

                var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                if (myEnd.Address == IPAddress.Any)
                {
                    client.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"), myEnd.Port));
                }
                else
                {
                    client.Connect(myEnd);
                }
                client.Close();
            }
            else
            {
                LogOutEvent(null, LogType.Error, "The MaxUserCout");
            }
        }
예제 #2
0
 void Accept()
 {
     if (SocketAsynPool.Count > 0)
     {
         SocketAsyncEventArgs sockasyn = SocketAsynPool.Pop();
         if (!Sock.AcceptAsync(sockasyn))
         {
             BeginAccep(sockasyn);
         }
     }
     else
     {
         LogOutEvent(null, LogType.Error, "The MaxUserCout");
     }
 }