예제 #1
0
        public void Initialize(NetworkProtocol protocol, IPEndPoint ipEndPoint)
        {
            _Protocal = protocol;
            try
            {
                switch (protocol)
                {
                case NetworkProtocol.KCP:
                    this.Service = new KService(ipEndPoint);
                    break;

                case NetworkProtocol.TCP:
                    this.Service = new TService(ipEndPoint);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                this.Service.AcceptCallback += this.OnAccept;

                this.StartAccept();
            }
            catch (Exception e)
            {
                throw new Exception($"{ipEndPoint}", e);
            }
        }
예제 #2
0
        public void Awake(NetworkProtocol protocol, IPEndPoint ipEndPoint)
        {
            try
            {
                switch (protocol)
                {
                case NetworkProtocol.TCP:
                    this.Service = new TService(ipEndPoint);
                    break;

                case NetworkProtocol.UDP:
                    this.Service = new UService(ipEndPoint);
                    break;

                case NetworkProtocol.KCP:
                    this.Service = new KService(ipEndPoint);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                this.StartAccept();
            }
            catch (Exception e)
            {
                throw new Exception($"{ipEndPoint}", e);
            }
        }
예제 #3
0
        public void Initialize(NetworkProtocol protocol)
        {
            _Protocal              = protocol;
            this.MessagePacker     = new SerializerPacker();
            this.MessageDispatcher = new ClientDispatcher();
            try
            {
                switch (protocol)
                {
                case NetworkProtocol.KCP:
                    this.Service = new KService();
                    break;

                case NetworkProtocol.TCP:
                    this.Service = new TService();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                this.Service.AcceptCallback += this.OnAccept;

                this.StartAccept();
            }
            catch (Exception e)
            {
                throw new Exception($"{e}");
            }
        }
        public void Awake(NetworkProtocol protocol, string host, int port)
        {
            try
            {
                switch (protocol)
                {
                case NetworkProtocol.TCP:
                    this.Service = new TService(host, port);
                    break;

                case NetworkProtocol.UDP:
                    this.Service = new UService(host, port);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                this.StartAccept();
            }
            catch (Exception e)
            {
                throw new Exception($"{host} {port}", e);
            }
        }
예제 #5
0
        protected void Awake(NetworkProtocol protocol)
        {
            switch (protocol)
            {
            case NetworkProtocol.TCP:
                this.Service = new TService();
                break;

            case NetworkProtocol.UDP:
                this.Service = new UService();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #6
0
        protected void Awake(NetworkProtocol protocol, string host, int port)
        {
            switch (protocol)
            {
            case NetworkProtocol.TCP:
                this.Service = new TService(host, port);
                break;

            case NetworkProtocol.UDP:
                this.Service = new UService(host, port);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            this.StartAccept();
        }
        public void Initialize(NetworkProtocol rProtocol)
        {
            this.MessagePacker     = new SerializerPacker();
            this.MessageDispatcher = new ClientDispatcher();

            switch (rProtocol)
            {
            case NetworkProtocol.TCP:
                this.mService = new TService();
                break;

            case NetworkProtocol.UDP:
                this.mService = new UService();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public void Initialize(NetworkProtocol rProtocol, string rHost, int nPort)
        {
            try
            {
                switch (rProtocol)
                {
                case NetworkProtocol.TCP:
                    this.mService = new TService(rHost, nPort);
                    break;

                case NetworkProtocol.UDP:
                    this.mService = new UService(rHost, nPort);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                this.StartAccept();
            }
            catch (Exception e)
            {
                throw new Exception($"{rHost} {nPort}", e);
            }
        }
예제 #9
0
 protected AChannel(AService service, ChannelType channelType)
 {
     this.Id          = IdGenerater.GenerateId();
     this.ChannelType = channelType;
     this.service     = service;
 }