コード例 #1
0
        public static SessionBase Create(IOThread ioThread, bool connect,
                                         SocketBase socket, Options options, Address addr)
        {
            SessionBase s;

            switch (options.SocketType)
            {
            case ZmqSocketType.Req:
                s = new Req.ReqSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Dealer:
                s = new Dealer.DealerSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Rep:
                s = new Rep.RepSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Router:
                s = new Router.RouterSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Pub:
                s = new Pub.PubSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Xpub:
                s = new XPub.XPubSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Sub:
                s = new Sub.SubSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Xsub:
                s = new XSub.XSubSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Push:
                s = new Push.PushSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Pull:
                s = new Pull.PullSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Pair:
                s = new Pair.PairSession(ioThread, connect, socket, options, addr);
                break;

            case ZmqSocketType.Stream:
                s = new Stream.StreamSession(ioThread, connect, socket, options, addr);
                break;

            default:
                throw new InvalidException("type=" + options.SocketType);
            }
            return(s);
        }
コード例 #2
0
ファイル: SessionBase.cs プロジェクト: JayShelton/netmq
        public static SessionBase Create(IOThread ioThread, bool connect,
                                                                         SocketBase socket, Options options, Address addr)
        {
            SessionBase s;
            switch (options.SocketType)
            {
                case ZmqSocketType.Req:
                    s = new Req.ReqSession(ioThread, connect,
                                                                     socket, options, addr);
                    break;
                case ZmqSocketType.Dealer:
                    s = new Dealer.DealerSession(ioThread, connect,
                                                                                socket, options, addr);
                    break;
                case ZmqSocketType.Rep:
                    s = new Rep.RepSession(ioThread, connect,
                                                                    socket, options, addr);
                    break;
                case ZmqSocketType.Router:
                    s = new Router.RouterSession(ioThread, connect,
                                                                                socket, options, addr);
                    break;
                case ZmqSocketType.Pub:
                    s = new Pub.PubSession(ioThread, connect,
                                                                    socket, options, addr);
                    break;
                case ZmqSocketType.Xpub:
                    s = new XPub.XPubSession(ioThread, connect,
                                                                     socket, options, addr);
                    break;
                case ZmqSocketType.Sub:
                    s = new Sub.SubSession(ioThread, connect,
                                                                     socket, options, addr);
                    break;
                case ZmqSocketType.Xsub:
                    s = new XSub.XSubSession(ioThread, connect,
                                                                        socket, options, addr);
                    break;

                case ZmqSocketType.Push:
                    s = new Push.PushSession(ioThread, connect,
                                                                        socket, options, addr);
                    break;
                case ZmqSocketType.Pull:
                    s = new Pull.PullSession(ioThread, connect,
                                                                        socket, options, addr);
                    break;
                case ZmqSocketType.Pair:
                    s = new Pair.PairSession(ioThread, connect,
                                                                        socket, options, addr);
                    break;
                case ZmqSocketType.Stream:
                    s = new Stream.StreamSession(ioThread, connect, socket, options, addr);
                    break;
                default:
                    throw InvalidException.Create("type=" + options.SocketType);

            }
            return s;
        }