Пример #1
0
 public void OnRecvBegin(IAsyncResult res)
 {
     try
     {
         Socket s = (Socket)res.AsyncState;
         if (!s.Connected)
         {
             Disconnect();
             return;
         }
         uint len = (uint)s.EndReceive(res);
         if (len > 0)
         {
             RecvEventArgs re = new RecvEventArgs(new Octets(Buffer, len));
             OnRecv(this, re);
             Skt.BeginReceive(Buffer, 0, (int)Constants.BUF_ALLOC_SIZE, SocketFlags.None, OnRecvBegin, Skt);
         }
         else
         {
             Disconnect();
         }
     }
     catch (Exception)
     {
         Disconnect();
     }
 }
Пример #2
0
        protected void OnServerRecv(object sender, RecvEventArgs e)
        {
            Octets os = e.Data.Clone();

            os.Reset();
            os = UpdateRecvSrv(os);
            Operative.EnqueueSrv(os);
        }
Пример #3
0
        protected void OnClientRecv(object sender, RecvEventArgs e)
        {
            Octets os = e.Data.Clone();

            os.Reset();
            os = UpdateRecvCli(os);
            Operative.EnqueueCli(os);
        }