Exemplo n.º 1
0
        public SessionTcp(ProtocolTcp protocol)
        {
            this.protocol      = protocol;
            this.accumulStream = sendStream1;

            acceptEventArgs  = new SocketAsyncEventArgs();
            connectEventArgs = new SocketAsyncEventArgs();
            rxEventArgs      = new SocketAsyncEventArgs();
            txEventArgs      = new SocketAsyncEventArgs();

            acceptEventArgs.Completed  += OnAcceptCompleted;
            connectEventArgs.Completed += OnConnectCompleted;
            rxEventArgs.Completed      += OnRecvCompleted;
            txEventArgs.Completed      += OnSendCompleted;

            rxList.Add(new ArraySegment <byte>(recvBuffer));
        }
Exemplo n.º 2
0
 /// <summary>
 /// 외부에서 소켓을 제공해주는 생성자. 수신을 시작한다.
 /// </summary>
 /// <param name="protocol"></param>
 /// <param name="socket"></param>
 public SessionTcp(ProtocolTcp protocol, Socket socket)
     : this(protocol)
 {
     this.socket = socket;
 }