Fixed the code for selecting ports when using multi robot, added missing dll files.#104
Open
Begelit wants to merge 1 commit intodji-sdk:masterfrom
Open
Fixed the code for selecting ports when using multi robot, added missing dll files.#104Begelit wants to merge 1 commit intodji-sdk:masterfrom
Begelit wants to merge 1 commit intodji-sdk:masterfrom
Conversation
…s from libmedia_codec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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))