/// <summary> /// accept /// </summary> public TChannel(TSocket socket, TService service) : base(service, ChannelType.Accept) { this.socket = socket; this.parser = new PacketParser(this.recvBuffer); this.RemoteAddress = socket.RemoteAddress; this.OnAccepted(); }
/// <summary> /// connect /// </summary> public TChannel(TSocket socket, string host, int port, TService service) : base(service, ChannelType.Connect) { this.socket = socket; this.parser = new PacketParser(this.recvBuffer); this.RemoteAddress = host + ":" + port; bool result = this.socket.ConnectAsync(host, port); if (!result) { this.OnConnected(this.Id, SocketError.Success); return; } this.socket.OnConn += e => OnConnected(this.Id, e); }
public TChannel(TSocket socket, string host, int port, TService service) : base(service) { this.socket = socket; this.parser = new PacketParser(this.recvBuffer); this.remoteAddress = host + ":" + port; }