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; }
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; }