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

            _endpoints = args.Data;
            this.Connect(this.GetNextEndPoint());
        }
Beispiel #2
0
 protected override void OnConnect(UvArgs args)
 {
     if (this.Status == HandleStatus.Open)
     {
         this.SendPacket();
     }
     else
     {
         this.Close();
     }
 }
Beispiel #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();
            }
        }
Beispiel #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()));
        }
Beispiel #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);
        }
Beispiel #6
0
 protected override void OnClose(UvArgs args)
 {
     Console.WriteLine("Client disconnected");
     base.OnClose(args);
 }
Beispiel #7
0
 protected override void OnClose(UvArgs args)
 {
     args.Throw();
 }
Beispiel #8
0
 protected override void OnOpen(UvArgs args)
 {
     args.Throw();
     this.Read();
 }
Beispiel #9
0
 protected override void OnOpen(UvArgs args)
 {
     args.Throw();
     this.Write(Encoding.UTF8.GetBytes(_data));
 }
Beispiel #10
0
        protected override void OnResolve(UvArgs<IPEndPoint[]> args)
        {
            if(!this.Check(args))
                return;

            _endpoints = args.Data;
            this.Connect(this.GetNextEndPoint());
        }
Beispiel #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()));
        }
Beispiel #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();
            }
        }
Beispiel #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;
        }
Beispiel #14
0
 protected override void OnConnect(UvArgs args)
 {
     if (this.Status == HandleStatus.Open)
         this.SendPacket();
     else
         this.Close();
 }
Beispiel #15
0
 protected override void OnClose(UvArgs args)
 {
     Console.WriteLine("Client disconnected");
     base.OnClose(args);
 }