1
"""A device based server."""
4
# Copyright (c) 2010 Brian E. Granger and Eugene Chernyshov
6
# This file is part of pyzmq.
8
# pyzmq is free software; you can redistribute it and/or modify it under
9
# the terms of the Lesser GNU General Public License as published by
10
# the Free Software Foundation; either version 3 of the License, or
11
# (at your option) any later version.
13
# pyzmq is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# Lesser GNU General Public License for more details.
18
# You should have received a copy of the Lesser GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
26
print 'Server', os.getpid()
29
socket = context.socket(zmq.REP)
31
socket.connect("inproc://workers")
34
message = socket.recv()
38
context = zmq.Context(1)
40
workers = context.socket(zmq.XREQ)
41
workers.bind("inproc://workers");
43
clients = context.socket(zmq.XREP)
44
clients.bind('tcp://127.0.0.1:5555')
47
thread = threading.Thread(target=routine, args=(context, ))
50
zmq.device(zmq.QUEUE, clients, workers)