Esempio n. 1
0
 // This method is invoked when an asynchronous send operation completes.
 // The method issues another receive on the socket to read any additional
 // data sent from the client
 //
 // <param name="e"></param>
 public void ProcessSend(SocketWrite e)
 {
     if (e.BytesTransferred != 0 && e.SocketError == SocketError.Success)
     {
         Console.WriteLine("成功发送了{0}字节数", e.BytesTransferred);
         if (e.BytesTransferred == e.Buffer.Length)
         {
             e.SetBuffer(null, 0, 0);
         }
         else
         {
             e.SetBuffer(e.BytesTransferred + e.Offset, e.Buffer.Length - e.BytesTransferred);
         }
         e?.ReacSocket?.SendData(null);
     }
     else
     {
         CloseClientSocket(e.ReacSocket as T);
     }
 }
Esempio n. 2
0
 public SocketRect()
 {
     writeEventArgs = new SocketWrite(this);
 }