Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the code for selecting ports when using multi robot, added missing dll files. #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Begelit
Copy link

@Begelit Begelit commented Oct 4, 2024

Problem solved when using multiEP.

Due to randomization when selecting ports, duplicate ports could be encountered, which caused a conflict
proto._port = random.randint(config.ROBOT_SDK_PORT_MIN, config.ROBOT_SDK_PORT_MAX)

Added check for repetition and port busy:
while True: port = random.randint(config.ROBOT_SDK_PORT_MIN, config.ROBOT_SDK_PORT_MAX) if port not in self._port_list: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: logger.info(port,proto._ip,s.connect_ex((proto._ip, port))) if s.connect_ex((proto._ip, port)) != 0: self._port_list.append(port) proto._port = port logger.info("Set up port: {0}".format(proto._port)) break else: logger.info("port {0} are using".format(port)) else: logger.info("Repeated port: {0}".format(port))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant