/// <summary> /// accept /// </summary> public UChannel(USocket socket, UService service) : base(service, ChannelType.Accept) { this.socket = socket; this.service = service; this.RemoteAddress = socket.RemoteAddress; this.socket.Received += this.OnRecv; this.socket.Disconnect += () => { this.OnError(this, SocketError.SocketError); }; }
/// <summary> /// connect /// </summary> public UChannel(USocket socket, string host, int port, UService service) : base(service, ChannelType.Connect) { this.socket = socket; this.service = service; this.RemoteAddress = host + ":" + port; this.socket.ConnectAsync(host, (ushort)port); this.socket.Received += this.OnRecv; this.socket.Disconnect += () => { this.OnError(this, SocketError.SocketError); }; }
/// <summary> /// connect /// </summary> public UChannel(USocket socket, IPEndPoint ipEndPoint, UService service) : base(service, ChannelType.Connect) { this.socket = socket; this.service = service; this.RemoteAddress = ipEndPoint; this.socket.ConnectAsync(ipEndPoint); this.socket.Received += this.OnRecv; this.socket.Disconnect += () => { this.OnError(this, SocketError.SocketError); }; }