예제 #1
0
파일: TChannel.cs 프로젝트: LJM74520/nice
        public TChannel(Socket socket, TService service) : base(service, ChannelType.Accept)
        {
            int packetSize = service.PacketSizeLength;

            this.packetSizeCache = new byte[packetSize];
            this.memoryStream    = service.MemoryStreamManager.GetStream("message", ushort.MaxValue);

            this.socket             = socket;
            this.socket.NoDelay     = true;
            this.parser             = new PacketParser(packetSize, this.recvBuffer, this.memoryStream);
            this.innArgs.Completed += this.OnComplete;
            this.outArgs.Completed += this.OnComplete;

            this.RemoteAddress    = socket.RemoteEndPoint.ToString();
            this.remoteIpEndPoint = (IPEndPoint)socket.RemoteEndPoint;
            this.isConnected      = true;
            this.isSending        = false;
        }
예제 #2
0
파일: TChannel.cs 프로젝트: LJM74520/nice
        public TChannel(IPEndPoint ipEndPoint, TService service) : base(service, ChannelType.Connect)
        {
            int packetSize = service.PacketSizeLength;

            this.packetSizeCache = new byte[packetSize];
            this.memoryStream    = service.MemoryStreamManager.GetStream("message", ushort.MaxValue);

            this.socket             = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            this.socket.NoDelay     = true;
            this.parser             = new PacketParser(packetSize, this.recvBuffer, this.memoryStream);
            this.innArgs.Completed += this.OnComplete;
            this.outArgs.Completed += this.OnComplete;

            this.RemoteAddress    = ipEndPoint.ToString();
            this.remoteIpEndPoint = ipEndPoint;
            this.isConnected      = false;
            this.isSending        = false;
        }