public TChannel(Socket socket, TService service) : base(service, ChannelType.Accept) { this.memoryStream = service.MemoryStreamManager.GetStream("message", ushort.MaxValue); this.socket = socket; this.socket.NoDelay = true; this.parser = new PacketParser(this.recvBuffer, this.memoryStream); this.innArgs.Completed += this.OnComplete; this.outArgs.Completed += this.OnComplete; this.RemoteAddress = (IPEndPoint)socket.RemoteEndPoint; this.isConnected = true; this.isSending = false; }
public TChannel(Socket socket, TService service) : base(service, ChannelType.Accept) { this.InstanceId = IdGenerater.GenerateId(); this.socket = socket; this.socket.NoDelay = true; this.parser = new PacketParser(this.recvBuffer); this.innArgs.Completed += this.OnComplete; this.outArgs.Completed += this.OnComplete; this.RemoteAddress = (IPEndPoint)socket.RemoteEndPoint; this.isConnected = true; this.isSending = false; }
public TChannel(IPEndPoint ipEndPoint, TService service) : base(service, ChannelType.Connect) { this.InstanceId = IdGenerater.GenerateId(); this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.socket.NoDelay = true; this.parser = new PacketParser(this.recvBuffer); this.innArgs.Completed += this.OnComplete; this.outArgs.Completed += this.OnComplete; this.RemoteAddress = ipEndPoint; this.isConnected = false; this.isSending = false; }
public TChannel(IPEndPoint ipEndPoint, TService service) : base(service, ChannelType.Connect) { this.memoryStream = this.GetService().MemoryStreamManager.GetStream("message", ushort.MaxValue); this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.socket.NoDelay = true; this.parser = new PacketParser(this.recvBuffer, this.memoryStream); this.innArgs.Completed += this.OnComplete; this.outArgs.Completed += this.OnComplete; this.RemoteAddress = ipEndPoint; this.isConnected = false; this.isSending = false; }
public TChannel(IPEndPoint ipEndPoint, TService service) : base(service, ChannelType.Connect) { this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.socket.NoDelay = true; this.parser = new PacketParser(this.recvBuffer); this.innArgs.Completed += this.OnComplete; this.outArgs.Completed += this.OnComplete; this.innArgs.UserToken = new UserTokenInfo() { InstanceId = this.InstanceId }; this.outArgs.UserToken = new UserTokenInfo() { InstanceId = this.InstanceId }; this.RemoteAddress = ipEndPoint; }
public TChannel(IPEndPoint ipEndPoint, TService service) : base(service, ChannelType.Connect) { Log.Debug($"<color=red>------------>>>TCP Connect. Address:{ipEndPoint.Address} Port:{ipEndPoint.Port}</color>"); 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; this.isConnected = false; this.isSending = false; }
public TChannel(Socket socket, TService service) : base(service, ChannelType.Accept) { this.socket = socket; this.socket.NoDelay = true; this.parser = new PacketParser(this.recvBuffer); this.innArgs.Completed += this.OnComplete; this.outArgs.Completed += this.OnComplete; this.innArgs.UserToken = new UserTokenInfo() { InstanceId = this.InstanceId }; this.outArgs.UserToken = new UserTokenInfo() { InstanceId = this.InstanceId }; this.RemoteAddress = (IPEndPoint)socket.RemoteEndPoint; this.isConnected = true; }
//构造函数 public TChannel(IPEndPoint ipEndPoint, TService service) : base(service, ChannelType.Connect) { //包体大小的占位长度 2个字节 int packetSize = service.PacketSizeLength; this.packetSizeCache = new byte[packetSize]; this.memoryStream = service.MemoryStreamManager.GetStream("message", ushort.MaxValue); //创建Socket this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.socket.NoDelay = true; //对解码器进行构造 传递包体大小占用的长度 接收的buffer 写入的内存流 this.parser = new PacketParser(packetSize, this.recvBuffer, this.memoryStream); this.innArgs.Completed += this.OnComplete; //接收异步操作完成时 this.outArgs.Completed += this.OnComplete; //发送异步操作完成时 this.RemoteAddress = ipEndPoint; this.isConnected = false; this.isSending = false; }