コード例 #1
0
ファイル: KService.cs プロジェクト: taigacon/ET
        private KChannel CreateAcceptChannel(IPEndPoint remoteEndPoint, uint remoteConn)
        {
            KChannel channel = new KChannel(++this.IdGenerater, remoteConn, this.socket, remoteEndPoint, this);
            KChannel oldChannel;

            if (this.idChannels.TryGetValue(channel.Id, out oldChannel))
            {
                this.idChannels.Remove(oldChannel.Id);
                oldChannel.Dispose();
            }
            this.idChannels[channel.Id] = channel;
            return(channel);
        }
コード例 #2
0
ファイル: KService.cs プロジェクト: taigacon/ET
        public override AChannel ConnectChannel(IPEndPoint remoteEndPoint)
        {
            uint     conv    = (uint)RandomHelper.RandomNumber(1000, int.MaxValue);
            KChannel channel = new KChannel(conv, this.socket, remoteEndPoint, this);
            KChannel oldChannel;

            if (this.idChannels.TryGetValue(channel.Id, out oldChannel))
            {
                this.idChannels.Remove(oldChannel.Id);
                oldChannel.Dispose();
            }
            this.idChannels[channel.Id] = channel;
            return(channel);
        }