示例#1
0
        protected override void OnResolve(UvArgs <IPEndPoint[]> args)
        {
            if (!this.Check(args))
            {
                return;
            }

            _endpoints = args.Data;
            this.Connect(this.GetNextEndPoint());
        }
示例#2
0
 protected override void OnConnect(UvArgs args)
 {
     if (this.Status == HandleStatus.Open)
     {
         this.SendPacket();
     }
     else
     {
         this.Close();
     }
 }
示例#3
0
        protected override void OnClose(UvArgs args)
        {
            if (!this.Check(args))
            {
                return;
            }

            try
            {
                if (_callback != null)
                {
                    _callback.Invoke(new UvWebClientGetArgs(null, this.GetResponse()));
                }
            }
            finally
            {
                this.Dispose();
            }
        }
示例#4
0
        protected override void OnConnect(UvArgs args)
        {
            if (!args.Successful)
            {
                var endpoint = this.GetNextEndPoint();
                if (endpoint != null)
                {
                    this.Connect(endpoint);
                    return;
                }
            }

            if (!this.Check(args))
            {
                return;
            }

            this.Write(Encoding.UTF8.GetBytes(this.GetRequest()));
        }
示例#5
0
        protected bool Check(UvArgs args)
        {
            if (args.Successful)
            {
                return(true);
            }

            try
            {
                if (_callback != null)
                {
                    _callback.Invoke(new UvWebClientGetArgs(args.Exception));
                }
            }
            finally
            {
                this.Dispose();
            }

            return(false);
        }
示例#6
0
 protected override void OnClose(UvArgs args)
 {
     Console.WriteLine("Client disconnected");
     base.OnClose(args);
 }
示例#7
0
 protected override void OnClose(UvArgs args)
 {
     args.Throw();
 }
示例#8
0
 protected override void OnOpen(UvArgs args)
 {
     args.Throw();
     this.Read();
 }
示例#9
0
 protected override void OnOpen(UvArgs args)
 {
     args.Throw();
     this.Write(Encoding.UTF8.GetBytes(_data));
 }
示例#10
0
        protected override void OnResolve(UvArgs<IPEndPoint[]> args)
        {
            if(!this.Check(args))
                return;

            _endpoints = args.Data;
            this.Connect(this.GetNextEndPoint());
        }
示例#11
0
        protected override void OnConnect(UvArgs args)
        {
            if(!args.Successful)
            {
                var endpoint = this.GetNextEndPoint();
                if(endpoint != null)
                {
                    this.Connect(endpoint);
                    return;
                }
            }

            if (!this.Check(args))
                return;

            this.Write(Encoding.UTF8.GetBytes(this.GetRequest()));
        }
示例#12
0
        protected override void OnClose(UvArgs args)
        {
            if (!this.Check(args))
                return;

            try
            {
                if (_callback != null)
                    _callback.Invoke(new UvWebClientGetArgs(null, this.GetResponse()));
            }
            finally
            {
                this.Dispose();
            }
        }
示例#13
0
        protected bool Check(UvArgs args)
        {
            if (args.Successful)
                return true;

            try
            {
                if (_callback != null)
                    _callback.Invoke(new UvWebClientGetArgs(args.Exception));
            }
            finally
            {
                this.Dispose();
            }

            return false;
        }
示例#14
0
 protected override void OnConnect(UvArgs args)
 {
     if (this.Status == HandleStatus.Open)
         this.SendPacket();
     else
         this.Close();
 }
示例#15
0
 protected override void OnClose(UvArgs args)
 {
     Console.WriteLine("Client disconnected");
     base.OnClose(args);
 }