public TChannel(Socket socket, TService service) : base(service, ChannelType.Accept) { int packetSize = service.PacketSizeLength; packetSizeCache = new byte[packetSize]; memoryStream = service.MemoryStreamManager.GetStream("message", ushort.MaxValue); this.socket = socket; socket.NoDelay = true; parser = new PacketParser(packetSize, recvBuffer, memoryStream); innArgs.Completed += OnComplete; outArgs.Completed += OnComplete; RemoteAddress = socket.RemoteEndPoint.ToString(); remoteIpEndPoint = (IPEndPoint)socket.RemoteEndPoint; isConnected = true; isSending = false; }
public TChannel(IPEndPoint ipEndPoint, TService service) : base(service, ChannelType.Connect) { int packetSize = service.PacketSizeLength; packetSizeCache = new byte[packetSize]; memoryStream = service.MemoryStreamManager.GetStream("message", ushort.MaxValue); socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.NoDelay = true; parser = new PacketParser(packetSize, recvBuffer, memoryStream); innArgs.Completed += OnComplete; outArgs.Completed += OnComplete; RemoteAddress = ipEndPoint.ToString(); remoteIpEndPoint = ipEndPoint; isConnected = false; isSending = false; }