def create_sockets(self):
ports = self.ports<EOL>context = zmq.Context()<EOL>poller = zmq.Poller()<EOL>rep = context.socket(zmq.REP)<EOL>if "<STR_LIT>" in ports:<EOL><INDENT>rep.bind(<EOL>"<STR_LIT>".format(port=ports["<STR_LIT>"])<EOL>)<EOL><DEDENT>else:<EOL><INDENT>ports["<STR_LIT>"] = rep.bind_to_random_port(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>pull = context.socket(zmq.PULL)<EOL>if "<STR_LIT>" in ports:<EOL><INDENT>pull.bind(<EOL>"<STR_LIT>".format(port=ports["<STR_LIT>"])<EOL>)<EOL><DEDENT>else:<EOL><INDENT>ports["<STR_LIT>"] = pull.bind_to_random_port(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>pub = context.socket(zmq.PUB)<EOL>if "<STR_LIT>" in ports:<EOL><INDENT>pub.bind(<EOL>"<STR_LIT>".format(port=ports["<STR_LIT>"])<EOL>)<EOL><DEDENT>else:<EOL><INDENT>ports["<STR_LIT>"] = pub.bind_to_random_port(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>poller.register(rep, zmq.POLLIN)<EOL>poller.register(pull, zmq.POLLIN)<EOL>sockets = dict(<EOL>poller=poller,<EOL>rep=rep,<EOL>pull=pull,<EOL>pub=pub<EOL>)<EOL>return sockets<EOL>
create zmq sockets