Exemplo n.º 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();
		}
Exemplo n.º 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);
		}
Exemplo n.º 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);
        }
Exemplo n.º 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;
 }