mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 19:51:31 +00:00
Create initial version of ControllerConnector
This commit is contained in:
parent
55ef87e089
commit
03d6f587e9
18
lib/tfw/networking/controller_connector.py
Normal file
18
lib/tfw/networking/controller_connector.py
Normal file
@ -0,0 +1,18 @@
|
||||
import zmq
|
||||
from zmq.eventloop import ioloop
|
||||
from zmq.eventloop.zmqstream import ZMQStream
|
||||
|
||||
from tfw.config import CONTROLLER_PORT
|
||||
from tfw.util import ZMQConnectorBase
|
||||
|
||||
ioloop.install()
|
||||
|
||||
|
||||
class ControllerConnector(ZMQConnectorBase):
|
||||
def __init__(self, zmq_context=None):
|
||||
super(ControllerConnector, self).__init__(zmq_context)
|
||||
self._zmq_rep_socket = self._zmq_context.socket(zmq.REP)
|
||||
self._zmq_rep_socket.connect('tcp://localhost:{}'.format(CONTROLLER_PORT))
|
||||
self._zmq_rep_stream = ZMQStream(self._zmq_rep_socket)
|
||||
|
||||
self.register_callback = self._zmq_rep_stream.on_recv
|
Loading…
Reference in New Issue
Block a user