Inheritance: AService
示例#1
0
		/// <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();
		}
示例#2
0
		/// <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);
		}
示例#3
0
        /// <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);
        }
示例#4
0
 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;
 }