Ejemplo n.º 1
0
        public XNetThread Send(JSON data, Action <XNetResult> cb)
        {
            JSON opt = new JSON(JSONType.Object);

            opt["ReadWriteTimeout"] = new JSON(this.tow);
            opt["Timeout"]          = new JSON(this.tor);

            XNetThread rx = new XNetThread(u, m, h, opt);

            rx.Data = data;
            switch (o)
            {
            case XNetMode.Asynchronous:
                if (!rx.SendAsych(cb))
                {
                    cb(new XNetResult(false));
                }
                break;

            case XNetMode.Synchronous:
                cb(rx.SendSynch());
                break;
            }
            return(rx);
        }
Ejemplo n.º 2
0
        public XNetThread Get(JSON data, Action <XNetResult> cb)
        {
            XNetThread rx = new XNetThread(u, XNetMethod.GET, h);

            rx.Data = data;
            switch (o)
            {
            case XNetMode.Asynchronous:
                if (!rx.SendAsych(cb))
                {
                    cb(new XNetResult(false));
                }
                break;

            case XNetMode.Synchronous:
                cb(rx.SendSynch());
                break;
            }
            return(rx);
        }