def publisherSocket(self,<EOL>port,<EOL>connect=False,<EOL>host='<STR_LIT:*>',<EOL>hwm=<NUM_LIT:1>):
socket = self._context.socket(zmq.PUB)<EOL>socket.setsockopt(zmq.SNDHWM, hwm)<EOL>socket.setsockopt(zmq.LINGER, <NUM_LIT:0>)<EOL>try:<EOL><INDENT>if connect:<EOL><INDENT>socket.connect(self.tcpAddress(host, port))<EOL><DEDENT>else:<EOL><INDENT>socket.bind(self.tcpAddress(host, port))<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>newMsg= str("<STR_LIT>" % (str(e), host, port))<EOL>raise (type(e))(newMsg)<EOL><DEDENT>return socket<EOL>
Create a PUB-style socket for data publishers.
If <connect> is true, connects to a XPUB/XSUB forwarding device.