Ejemplo n.º 1
0
        public override AChannel GetChannel(long id)
        {
            TChannel rChannel = null;

            this.mIdChannels.TryGetValue(id, out rChannel);
            return(rChannel);
        }
Ejemplo n.º 2
0
        public override AChannel ConnectChannel(IPEndPoint rIpEndPoint)
        {
            TcpClient tcpClient = new TcpClient();
            TChannel  rChannel  = new TChannel(tcpClient, rIpEndPoint, this);

            this.mIdChannels[rChannel.Id] = rChannel;

            return(rChannel);
        }
Ejemplo n.º 3
0
        public override async Task <AChannel> AcceptChannel()
        {
            if (this.mAcceptor == null)
            {
                throw new Exception("service construct must use host and port param");
            }
            TcpClient rTcpClient = await this.mAcceptor.AcceptTcpClientAsync();

            TChannel rChannel = new TChannel(rTcpClient, this);

            this.mIdChannels[rChannel.Id] = rChannel;
            return(rChannel);
        }
Ejemplo n.º 4
0
        public override void Dispose()
        {
            if (this.mAcceptor == null)
            {
                return;
            }

            foreach (long id in this.mIdChannels.Keys.ToArray())
            {
                TChannel channel = this.mIdChannels[id];
                channel.Dispose();
            }
            this.mAcceptor.Stop();
            this.mAcceptor = null;
        }