Beispiel #1
0
        //  Create a socket of a specified type.
        public static SocketBase Create(ZmqSocketType type, Ctx parent,
                                        int tid, int sid)
        {
            SocketBase s;

            switch (type)
            {
            case ZmqSocketType.Pair:
                s = new Pair(parent, tid, sid);
                break;

            case ZmqSocketType.Pub:
                s = new Pub(parent, tid, sid);
                break;

            case ZmqSocketType.Sub:
                s = new Sub(parent, tid, sid);
                break;

            case ZmqSocketType.Req:
                s = new Req(parent, tid, sid);
                break;

            case ZmqSocketType.Rep:
                s = new Rep(parent, tid, sid);
                break;

            case ZmqSocketType.Dealer:
                s = new Dealer(parent, tid, sid);
                break;

            case ZmqSocketType.Router:
                s = new Router(parent, tid, sid);
                break;

            case ZmqSocketType.Pull:
                s = new Pull(parent, tid, sid);
                break;

            case ZmqSocketType.Push:
                s = new Push(parent, tid, sid);
                break;

            case ZmqSocketType.Xpub:
                s = new XPub(parent, tid, sid);
                break;

            case ZmqSocketType.Xsub:
                s = new XSub(parent, tid, sid);
                break;

            case ZmqSocketType.Stream:
                s = new Stream(parent, tid, sid);
                break;

            default:
                throw InvalidException.Create("type=" + type);
            }
            return(s);
        }
Beispiel #2
0
        //  Create a socket of a specified type.
        public static SocketBase Create(ZmqSocketType type, Ctx parent,
                                                                                                                                        int tid, int sid)
        {
            SocketBase s;
            switch (type)
            {

                case ZmqSocketType.Pair:
                    s = new Pair(parent, tid, sid);
                    break;
                case ZmqSocketType.Pub:
                    s = new Pub(parent, tid, sid);
                    break;
                case ZmqSocketType.Sub:
                    s = new Sub(parent, tid, sid);
                    break;
                case ZmqSocketType.Req:
                    s = new Req(parent, tid, sid);
                    break;
                case ZmqSocketType.Rep:
                    s = new Rep(parent, tid, sid);
                    break;
                case ZmqSocketType.Dealer:
                    s = new Dealer(parent, tid, sid);
                    break;
                case ZmqSocketType.Router:
                    s = new Router(parent, tid, sid);
                    break;
                case ZmqSocketType.Pull:
                    s = new Pull(parent, tid, sid);
                    break;
                case ZmqSocketType.Push:
                    s = new Push(parent, tid, sid);
                    break;

                case ZmqSocketType.Xpub:
                    s = new XPub(parent, tid, sid);
                    break;

                case ZmqSocketType.Xsub:
                    s = new XSub(parent, tid, sid);
                    break;
                case ZmqSocketType.Stream:
                    s = new Stream(parent, tid, sid);
                    break;
                default:
                    throw InvalidException.Create("type=" + type);
            }
            return s;
        }