Method for solving port conflict and computer readable memory medium
A storage medium and computer technology, applied in the field of communications, can solve problems such as unfriendly user experience, and achieve the effects of improving user experience, avoiding port conflicts, and improving stability
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0075] Please refer to figure 2 , Embodiment 1 of the present invention is: a kind of method for resolving port conflict, described method is based on TCP / IP agreement network transmission, comprises the following steps:
[0076] S1: The server randomly selects an available port for binding;
[0077] S2: The client traverses the ports of the device where the server is located, that is, traverses port 1025 to port 65535 on the machine where the server is located;
[0078] S3: The client establishes a connection with a port;
[0079] S4: judging whether the connection is successful, further, judging whether the connection is successful by judging whether the one port is bound, if the one port is not bound, then judging that the connection fails, and the client establishes a connection with the next port, That is, return to step S3, if the port has been bound, it is determined that the connection is successful, and step S5 is executed.
[0080] S5: the client sends a preset i...
Embodiment 2
[0098] This embodiment is a specific application scenario of the foregoing embodiments.
[0099] Nowadays, the complexity of software is very high. In order to reduce the complexity, a software is divided into multiple modules, and there must be interaction between modules. If there are programs between modules and modules, inter-process communication is required between programs, and inter-process communication uses local TCP network communication. The simple implementation solution is to agree on communication ports between interactive programs, establish connections for communication, and agree on ports It is inevitable that there will be port conflicts and the connection cannot be established, and this problem can be solved by this embodiment.
[0100] Assuming that program A acts as a server, it randomly selects an available port (such as 20034) to bind and listen; program B acts as a client, and obtains a list of ports currently used by the operating system after startup...
Embodiment 3
[0104] This embodiment is a computer-readable storage medium corresponding to the above-mentioned embodiments, on which a computer program is stored, and when the program is executed by a processor, the following steps are implemented:
[0105] The server randomly selects an available port for binding;
[0106] The client establishes a connection with the port of the device where the server is located;
[0107] If the connection is successful, the client sends a preset query message to the connected peer through the connection;
[0108] The client receives the feedback message sent by the peer end of the connection, and identifies the feedback message;
[0109] If the identification is correct, it is determined that the port corresponding to the connection is the port bound to the server.
[0110] Further, after the "client sends a preset inquiry message to the connection peer through the connection", it further includes:
[0111] The peer end of the connection identifies t...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com