'Bind or connect to ZMQ socket. Requires package zmq.'

def connect(self):

    context = zmq.Context()
    self.socket = context.socket(self.socket_type)
    self.socket.setsockopt(zmq.LINGER, 1)
    host = 'tcp://{}:{}'.format(self.address, self.port)
    if (self.socket_type == zmq.REP):
        self.socket.bind(host)
    else:
        self.socket.connect(host)
    print ('python    thread    connected    to    ' + host)
