Esempio n. 1
0
 public TcpTransport(Socket socket, TcpTransportSettings transportSettings) : base("tcp")
 {
     this.socket                   = socket;
     this.socket.NoDelay           = true;
     this.socket.SendBufferSize    = 0;
     this.socket.ReceiveBufferSize = 0;
     this.localEndPoint            = this.socket.LocalEndPoint;
     this.remoteEndPoint           = this.socket.RemoteEndPoint;
     this.sendEventArgs            = new TcpTransport.WriteAsyncEventArgs()
     {
         Transport = this
     };
     this.sendEventArgs.Completed    += TcpTransport.onWriteComplete;
     this.receiveEventArgs            = new TcpTransport.ReadAsyncEventArgs();
     this.receiveEventArgs.Completed += TcpTransport.onReadComplete;
     this.receiveEventArgs.Transport  = this;
 }
Esempio n. 2
0
 private static void OnWriteComplete(object sender, SocketAsyncEventArgs socketArgs)
 {
     TcpTransport.WriteAsyncEventArgs writeAsyncEventArg = (TcpTransport.WriteAsyncEventArgs)socketArgs;
     writeAsyncEventArg.Transport.HandleWriteComplete(writeAsyncEventArg.Args, false);
 }