CN111385372B - Network service discovery method, client, server and electronic equipment - Google Patents

Network service discovery method, client, server and electronic equipment Download PDF

Info

Publication number
CN111385372B
CN111385372B CN201910267813.XA CN201910267813A CN111385372B CN 111385372 B CN111385372 B CN 111385372B CN 201910267813 A CN201910267813 A CN 201910267813A CN 111385372 B CN111385372 B CN 111385372B
Authority
CN
China
Prior art keywords
address
server
response message
connection state
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910267813.XA
Other languages
Chinese (zh)
Other versions
CN111385372A (en
Inventor
朱增辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitevision Co Ltd
Original Assignee
Hitevision Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitevision Co Ltd filed Critical Hitevision Co Ltd
Priority to CN201910267813.XA priority Critical patent/CN111385372B/en
Publication of CN111385372A publication Critical patent/CN111385372A/en
Application granted granted Critical
Publication of CN111385372B publication Critical patent/CN111385372B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5069Address allocation for group communication, multicast communication or broadcast communication
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks

Abstract

The invention discloses a network service discovery method, a client, a server and electronic equipment, which comprises the following steps: transmitting a broadcast message, the broadcast message including a port number of a server; receiving a response message sent by the server, wherein the response message comprises a network address, a unique identification number and a timestamp of the server; and determining a network address for establishing network connection with the server according to the response message. The invention can automatically acquire the network address of the server and realize the quick network connection between the client and the server.

Description

Network service discovery method, client, server and electronic equipment
Technical Field
The present invention relates to the field of computer network technologies, and in particular, to a network service discovery method, a client, a server, and an electronic device.
Background
At present, network connection is established between a client and a server, a network address (IP address) of the server needs to be known in advance, the network address of the server can be changed due to modification or dynamic allocation, the client needs to manually inquire and input the current network address of the server before connecting the server, normal network connection between the client and the server can be realized, the operation is complex, and time and labor are wasted.
Especially in an application scenario that the electronic whiteboard is connected with the mobile terminal, the mobile terminal (such as an intelligent mobile phone, an IPAD and other intelligent mobile terminals) needs to establish network connection with the electronic whiteboard to realize data interaction between the mobile terminal and the electronic whiteboard, the electronic whiteboard serves as a server, an IP address may be dynamically allocated in a starting process, a current IP address of the electronic whiteboard needs to be acquired before the mobile terminal is connected with the electronic whiteboard, and then network connection between the mobile terminal and the electronic whiteboard is established; on the other hand, the electronic whiteboard may be configured with a plurality of network card units such as a wired network card and a wireless network card, so as to have a plurality of IP addresses corresponding to the number of the network cards, and the mobile terminal needs to determine the only one IP address for establishing network connection.
Disclosure of Invention
In view of this, an object of the present invention is to provide a network service discovery method, a client, a server, and an electronic device, where the client can quickly determine a network address for establishing a network connection with the server.
Based on the above purpose, the present invention provides a network service discovery method, applied to a client, including:
sending a broadcast message, wherein the broadcast message comprises a port number of a server;
receiving a response message sent by the server, wherein the response message comprises a network address, a unique identification number and a timestamp of the server;
and determining a network address for establishing network connection with the server according to the response message.
Optionally, a plurality of response messages are received, the response messages are analyzed, an IP address, a unique identification number, and a timestamp of each response message are obtained, if the IP addresses of the response messages are not consistent and the unique identification numbers are consistent, the response messages are sorted according to the sequence of the timestamps, and the IP address in the response message with the earliest time is selected as the IP address of the server.
Optionally, a plurality of response messages are received and analyzed to obtain an IP address, a unique identification number, and a timestamp of each response message, and if the IP addresses of the response messages are consistent and the unique identification numbers are consistent, the IP address in the response message is used as the IP address of the server.
Optionally, the plurality of response messages are continuously received, the plurality of response messages are analyzed to obtain the IP address, the unique identification number, and the timestamp of each response message, the network connection state of each response message is judged according to the IP address, the unique identification number, and the timestamp of each response message, and the IP address in the response message with the best network connection state is selected as the IP address of the server.
The embodiment of the invention also provides a network service discovery method, which is applied to the server and comprises the following steps:
receiving a broadcast message sent by a client;
and when the port number of the broadcast message is consistent with the port number of the server, sending a response message, wherein the response message comprises the network address, the unique identification number and the timestamp of the server.
Optionally, the server includes a plurality of network card units, each network card unit corresponds to a corresponding network address, each network card unit sends the response message, and each response message includes a network address corresponding to a corresponding network card unit, a unique identification number of the server, and a timestamp of the response message sent by the corresponding network card unit.
Optionally, the timestamp is accurate to the millisecond or microsecond level.
An embodiment of the present invention further provides a client, including:
a first message sending module, configured to send a broadcast message, where the broadcast message includes a port number of a server;
the first message receiving module is used for receiving a response message sent by the server, wherein the response message comprises a network address, a unique identification number and a timestamp of the server;
and the message analysis module is used for determining a network address for establishing network connection with the server according to the response message.
Optionally, the first message receiving module receives a plurality of response messages, the message analyzing module analyzes the plurality of response messages to obtain an IP address, a unique identification number, and a timestamp of each response message, if the IP addresses of the response messages are not consistent and the unique identification numbers are consistent, the response messages are sorted according to the sequence of the timestamps, and the IP address in the response message with the earliest time is selected as the IP address of the server.
Optionally, the first message receiving module receives a plurality of response messages, the message parsing module parses the plurality of response messages to obtain an IP address, a unique identification number, and a timestamp of each response message, and if the IP addresses of the response messages are consistent and the unique identification numbers are consistent, the IP address in the response message is used as the IP address of the server.
Optionally, the first message receiving module continuously receives the plurality of response messages, analyzes the plurality of response messages to obtain the IP address, the unique identification number, and the timestamp of each response message, determines the network connection status of each response message according to the IP address, the unique identification number, and the timestamp of each response message, and selects the IP address in the response message with the best network connection status as the IP address of the server.
An embodiment of the present invention further provides a server, including:
the second message receiving module is used for receiving the broadcast message sent by the client;
and the second message sending module is used for sending a response message when the port number of the broadcast message is judged to be consistent with the port number of the server, wherein the response message comprises the network address, the unique identification number and the timestamp of the server.
Optionally, the server includes a plurality of network card units, each network card unit corresponds to a corresponding network address, each network card unit sends the response message, and each response message includes a network address corresponding to a corresponding network card unit, a unique identification number of the server, and a timestamp of the response message sent by the corresponding network card unit.
Optionally, the timestamp is accurate to millisecond or microsecond.
The embodiment of the invention also provides electronic equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor realizes the network discovery method when executing the program.
As can be seen from the foregoing, according to the network service discovery method, the client, the server, and the electronic device provided by the present invention, the client sends the broadcast message including the server port, the server receives the broadcast message, sends the response message including the network address, the unique identification number, the timestamp, and the like of the server to the client, and the client receives and analyzes the response message, and determines the network address for establishing network connection with the server. The invention can automatically acquire the network address of the server and realize the quick network connection between the client and the server.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method applied to a client according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method applied to a server according to an embodiment of the present invention;
FIG. 3 is a block diagram of a client according to an embodiment of the present invention;
FIG. 4 is a block diagram of a server according to an embodiment of the present invention;
fig. 5 is a block diagram of a system configuration according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail with reference to the following embodiments and the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
The embodiment of the invention provides a network service discovery method applied to a client, which comprises the following steps:
sending a broadcast message, wherein the broadcast message comprises a port number of a server;
receiving a response message sent by a server, wherein the response message comprises a network address, a unique identification number and a timestamp of the server;
and determining a network address for establishing network connection with the server according to the response message.
In the embodiment of the invention, a client sends a UDP broadcast message firstly, the UDP broadcast message comprises a port number of a server, the server receives the UDP broadcast message and judges that the port number is consistent with the port number of the server, the server sends a response message to the client, the response message comprises a network address, a unique identification number and a timestamp of the server, the client receives the response message, analyzes the response message, acquires the network address of the server and establishes network connection with the server according to the network address of the server. The invention can automatically acquire the network address of the server, thereby realizing the network connection between the client and the server.
Fig. 1 is a schematic flowchart of a method applied to a client according to an embodiment of the present invention, and as shown in the drawing, the method for discovering a network service applied to the client according to the embodiment of the present invention includes:
s10: transmitting a broadcast message, the broadcast message including a port number of a server;
and the client sends a UDP broadcast message to the terminal of the same network segment, wherein the UDP broadcast message comprises the port number of the server. The port number of the server may be determined by pre-negotiation between the server and the client.
S11: receiving a response message sent by a server, wherein the response message comprises a network address, a unique identification number and a timestamp of the server;
as shown in fig. 5, the client sends the UDP broadcast message, the host receiving the UDP broadcast message determines whether the port number of the host is consistent with the port number in the UDP broadcast message, the host with the consistent port number is the server, and the server sends a response message to the client according to the received UDP broadcast message, where the response message includes an IP address, a unique identification number, a timestamp, and the like of the server, and if data content needs to be sent, the response message also includes data content; the unique identification number is a unique number for identifying the server, and may be a global unique identification number (GUID) generated in advance by the server.
The server is provided with a plurality of network card units, the server has network addresses corresponding to the number of the network card units, each network card unit sends corresponding response messages to the client, each response message comprises an IP address, a unique identification number, a timestamp and the like corresponding to the network card unit, and if data content needs to be sent, each response message also comprises data content; the unique identification numbers of the response messages are consistent and are the unique identification numbers of the server, and the time stamp of each response message is the time for the corresponding network card unit to send the corresponding response message, and in one embodiment, the time stamp can be accurate to millisecond level or microsecond level, so that the sequence of each response message can be determined according to the time sequence; and if the data content needing to be transmitted exists, the data content of each response message is consistent.
S12: and determining a network address for establishing network connection with the server according to the response message.
And the client receives the response message returned by the server, analyzes the response message and acquires the IP address, the unique identification number and the timestamp in the response message.
For the condition that the server only has one network card unit, a response message can be received under normal conditions, and the IP address in the response message is the IP address of the server; if a plurality of response messages are received due to retransmission and the like, the IP addresses of the response messages are judged to be consistent according to the IP addresses and the unique identification numbers of the response messages, the server can be judged to have only one network card unit if the unique identification numbers of the response messages are consistent, at the moment, the IP addresses in the response messages can be directly used as the IP addresses of the server, and the subsequent client side establishes network connection with the server through the IP addresses and the known port numbers.
For the condition that the server has a plurality of network card units, if a plurality of response messages are received, the IP addresses of the response messages are judged to be inconsistent according to the IP addresses and the unique identification numbers of the response messages, the server can be judged to have a plurality of network card units, at the moment, the response messages are sequenced according to the timestamps of the response messages, after the sequencing, the IP address in the response message with the earliest time (the response is fastest) is used as the IP address of the server, and the subsequent client establishes network connection with the server through the IP address and the known port number.
Optionally, when the server has a plurality of network card units, one network card unit with the best network connection state may be selected from the plurality of network card units, and the IP address of the network card unit is used as the IP address of the server to establish network connection with the client. The method for selecting the optimal network card unit can be a plurality of indexes such as judging that the response speed is high according to a plurality of response messages received within a certain time and a time stamp, judging that the problems of packet loss and disorder are less according to the sequence number of the data packet, judging that the data content is complete according to the data content, and the like. Or, an IP address is determined according to the timestamp for the first time, after the network card unit corresponding to the IP address is determined, the UDP broadcast message is continuously sent, the corresponding response message is continuously received, a network card unit with the best current network connection state is selected according to a plurality of response messages received within a certain time, and if the network card unit with the best current network connection state is different from the network card unit with the best current network connection state, the network card unit with the best current actual connection state is switched to the network card unit with the best current network connection state, so that the best network connection state is maintained between the client and the server.
Fig. 2 is a schematic flowchart of a method applied to a server according to an embodiment of the present invention. As shown in the figure, the network service discovery method applied to the server provided by the embodiment of the present invention includes:
s20: receiving a broadcast message sent by a client;
s21: and when the port number of the broadcast message is consistent with the port number of the broadcast message, sending a response message, wherein the response message comprises the network address of the server, the unique identification number and the timestamp.
The client firstly sends a UDP broadcast message for acquiring the network address of the server, the server judges that the port number is consistent with the port number of the server after receiving the UDP broadcast message, and returns a response message to the client, wherein the response message carries the network address, the unique identification number and the timestamp of the server, and if the server has data content, the response message simultaneously carries the data content.
In the embodiment of the present invention, the server may be configured with one or more network card units, and for the case of multiple network card units, after receiving the UDP broadcast message, each network card unit sends a corresponding response message to the client, and each response message carries an IP address of the corresponding network card unit, a unique identification number of the server, and a timestamp of the response message sent by the corresponding network card unit, respectively, where the timestamp may be accurate to millisecond or microsecond, so that the client determines, according to the timestamp, the network card unit that responds most quickly.
The client receives the response message sent by the server, if only one response message exists, the IP address in the response message is used as the IP address of the server, and then network connection is established with the server according to the IP address. If a plurality of response messages exist, analyzing each response message, sequencing each response message according to the sequence of the timestamps under the condition that the unique identification numbers are judged to be consistent and the IP addresses are not consistent, selecting the IP address carried by the response message corresponding to the timestamp with the earliest time as the IP address of the server, and then establishing network connection with the server according to the IP address.
Fig. 3 is a block diagram of a client according to an embodiment of the present invention. As shown in the figure, the client provided in the embodiment of the present invention includes:
a first message sending module, configured to send a broadcast message, where the broadcast message includes a port number of a server;
the first message receiving module is used for receiving a response message sent by the server, wherein the response message comprises a network address, a unique identification number and a timestamp of the server;
and the message analysis module is used for determining a network address for establishing network connection with the server according to the response message.
And the client sends a UDP broadcast message to the terminal in the same network segment, wherein the UDP broadcast message comprises the port number of the server. The port number of the server may be determined by pre-negotiation between the server and the client.
As shown in fig. 5, the client sends the UDP broadcast message, the host receiving the UDP broadcast message determines whether the port number of the host is consistent with the port number in the UDP broadcast message, the host with the consistent port number is the server, and the server sends a response message to the client according to the received UDP broadcast message, where the response message includes an IP address, a unique identification number, a timestamp, and the like of the server, and if data content needs to be sent, the response message also includes data content; the unique identification number is a unique number for identifying the server, and may be a global unique identification number (GUID) generated in advance by the server.
The server is provided with a plurality of network card units, the server has network addresses corresponding to the number of the network card units, each network card unit sends corresponding response messages to the client, each response message comprises an IP address, a unique identification number, a timestamp and the like corresponding to the network card unit, and if data content needs to be sent, each response message also comprises data content; the unique identification numbers of the response messages are consistent and are the unique identification numbers of the server, and the time stamp of each response message is the time for the corresponding network card unit to send the corresponding response message, and in one embodiment, the time stamp can be accurate to millisecond level or microsecond level so as to determine the sequence of each response message according to the time sequence; and if the data content needing to be transmitted exists, the data content of each response message is consistent.
And a first message receiving module of the client receives the response message returned by the server, and a message analysis module analyzes the response message to acquire the IP address, the unique identification number and the timestamp in the response message.
For the condition that the server only has one network card unit, a response message can be received under normal conditions, and the IP address in the response message is the IP address of the server; if a plurality of response messages are received due to retransmission and the like, the IP addresses of the response messages are judged to be consistent according to the IP addresses and the unique identification numbers of the response messages, the server can be judged to have only one network card unit if the unique identification numbers of the response messages are consistent, at the moment, the IP addresses in the response messages can be directly used as the IP addresses of the server, and the subsequent client side establishes network connection with the server through the IP addresses and the known port numbers.
For the condition that the server has a plurality of network card units, if a plurality of response messages are received, the IP addresses of the response messages are judged to be inconsistent according to the IP addresses and the unique identification numbers of the response messages, the server can be judged to have a plurality of network card units, at the moment, the response messages are sequenced according to the timestamps of the response messages, after the sequencing, the IP address in the response message with the earliest time (the response is the fastest) is taken as the IP address of the server, and the subsequent client establishes network connection with the server through the IP address and the known port number.
Optionally, when the server has a plurality of network card units, one network card unit with the best network connection state may be selected from the plurality of network card units, and the IP address of the network card unit is used as the IP address of the server to establish network connection with the client. The method for selecting the optimal network card unit can be a plurality of indexes such as judging that the response speed is high according to a plurality of response messages received within a certain time and a time stamp, judging that the packet loss and the disorder problem are less according to the sequence number of the data packet, and judging that the data content is complete according to the data content. Or, an IP address is determined according to the timestamp for the first time, after the network card unit corresponding to the IP address is determined, UDP broadcast messages are continuously sent, corresponding response messages are continuously received, a network card unit with the best current network connection state is selected according to a plurality of response messages received within a certain time, and if the network card unit with the best current network connection state is different from the network card unit with the best current actual connection state, the network card unit with the best current actual connection state is switched to the network card unit with the best current network connection state, so that the best network connection state is maintained between the client and the server.
Fig. 4 is a block diagram of a server according to an embodiment of the present invention. As shown in the figure, the server provided in the embodiment of the present invention includes:
the second message receiving module is used for receiving the broadcast message sent by the client;
and the second message sending module is used for sending a response message when judging that the port number of the broadcast message is consistent with the port number of the second message sending module, wherein the response message comprises the network address, the unique identification number and the timestamp of the server.
The client firstly sends a UDP broadcast message for acquiring the network address of the server, the server judges that the port number is consistent with the port number of the server after receiving the UDP broadcast message, and returns a response message to the client, wherein the response message carries the network address, the unique identification number and the timestamp of the server, and if the network address, the unique identification number and the timestamp of the server exist, the response message simultaneously carries data content.
In the embodiment of the present invention, the server may be configured with one or more network card units, and for the case of multiple network card units, after receiving the UDP broadcast message, each network card unit sends a corresponding response message to the client, and each response message carries an IP address of the corresponding network card unit, a unique identification number of the server, and a timestamp of the response message sent by the corresponding network card unit, respectively, where the timestamp may be accurate to millisecond or microsecond, so that the client determines, according to the timestamp, the network card unit that responds most quickly.
And the client receives the response message sent by the server, if only one response message exists, the IP address in the response message is used as the IP address of the server, and then the network connection is established with the server according to the IP address. And if a plurality of response messages exist, analyzing each response message, sequencing each response message according to the time stamp sequence under the condition of judging that the unique identification numbers are consistent and the IP addresses are inconsistent, selecting the IP address carried by the response message corresponding to the time stamp with the earliest time as the IP address of the server, and establishing network connection with the server according to the IP address.
Based on the above object, an embodiment of an apparatus for performing the network service discovery method is further provided in the embodiments of the present invention. The device comprises:
one or more processors, and a memory.
The apparatus for performing the network service discovery method may further include: an input device and an output device.
The processor, memory, input device, and output device may be connected by a bus or other means.
The memory, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the network service discovery method in the embodiments of the present invention. The processor executes various functional applications and data processing of the server by running nonvolatile software programs, instructions and modules stored in the memory, that is, the network service discovery method of the above method embodiment is realized.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of a device performing the network service discovery method, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, the memory optionally includes memory remotely located from the processor, and these remote memories may be connected to the member user behavior monitoring device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input means may receive input numeric or character information and generate key signal inputs related to user settings and function control of the apparatus performing the network service discovery method. The output device may include a display device such as a display screen.
The one or more modules are stored in the memory and, when executed by the one or more processors, perform the network service discovery method of any of the above method embodiments. The technical effect of the embodiment of the device for executing the network service discovery method is the same as or similar to that of any method embodiment.
An embodiment of the present invention further provides a non-transitory computer storage medium, where the computer storage medium stores computer executable instructions, and the computer executable instructions may execute a processing method for list item operation in any method embodiment described above. Embodiments of the non-transitory computer storage medium may have the same or similar technical effects as any of the method embodiments described above.
Finally, it should be noted that, as will be understood by those skilled in the art, all or part of the processes in the methods of the above embodiments may be implemented by a computer program that can be stored in a computer-readable storage medium and that, when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like. The technical effect of the embodiment of the computer program is the same as or similar to that of any of the method embodiments described above.
Furthermore, the apparatuses, devices, etc. described in the present disclosure may typically be various electronic terminal devices, such as a mobile phone, a Personal Digital Assistant (PDA), a tablet computer (PAD), a smart television, etc., or may be a large terminal device, such as a server, etc., and thus the scope of protection of the present disclosure should not be limited to a specific type of apparatus, device. The client disclosed by the present disclosure may be applied to any one of the above electronic terminal devices in the form of electronic hardware, computer software, or a combination of both.
Furthermore, the method according to the present disclosure may also be implemented as a computer program executed by a CPU, which may be stored in a computer-readable storage medium. The computer program, when executed by the CPU, performs the above-described functions defined in the method of the present disclosure.
Further, the above method steps and system elements may also be implemented using a controller and a computer readable storage medium for storing a computer program for causing the controller to implement the functions of the above steps or elements.
Further, it should be appreciated that the computer-readable storage media (e.g., memory) described herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which can act as external cache memory. By way of example and not limitation, RAM may be available in a variety of forms such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
The apparatus of the foregoing embodiment is used to implement the corresponding method in the foregoing embodiment, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the idea of the invention, also features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity.
In addition, well known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown within the provided figures for simplicity of illustration and discussion, and so as not to obscure the invention. Furthermore, devices may be shown in block diagram form in order to avoid obscuring the invention, and also in view of the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform within which the present invention is to be implemented (i.e., specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the invention, it should be apparent to one skilled in the art that the invention can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative instead of restrictive.
While the present invention has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art in light of the foregoing description. For example, other memory architectures, such as Dynamic RAM (DRAM), may use the discussed embodiments.
The embodiments of the invention are intended to embrace all such alternatives, modifications and variances that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, substitutions, improvements and the like that may be made without departing from the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (14)

1. A network service discovery method is applied to a client, and is characterized by comprising the following steps:
sending a broadcast message, wherein the broadcast message comprises a port number of a server;
continuously receiving a plurality of response messages sent by the server, wherein the response messages comprise the network address, the unique identification number and the timestamp of the server;
analyzing the plurality of response messages to obtain the IP address, the unique identification number and the timestamp of each response message;
judging the network connection state of each response message according to the IP address, the unique identification number and the timestamp of each response message, and selecting the IP address in the response message with the best network connection state as the IP address of the server;
wherein, according to the IP address, the unique identification number and the timestamp of each response message, judging the network connection state of each response message, and selecting the IP address in the response message with the best network connection state as the IP address of the server, comprises:
judging the network connection state of each response message according to whether the time stamp and the sequence number of the data packet of each response message are continuous and/or the data content is complete; wherein, the data packet serial number and/or the data content are obtained by analyzing the response message;
selecting the IP address in the response message with the earliest time for the first time as the IP address of the server;
selecting an IP address with the best current network connection state according to a plurality of response messages received within a certain time; and if the IP address with the best current network connection state is different from the IP address with the best current actual connection state, switching the IP address with the best current actual connection state into the IP address with the best current network connection state.
2. The method of claim 1, wherein the first picking the IP address in the earliest response message as the IP address of the server comprises:
and if the IP addresses of the response messages are not consistent and the unique identification numbers are consistent, sequencing the response messages according to the sequence of the timestamps, and selecting the IP address in the response message with the earliest time as the IP address of the server.
3. The method according to claim 1, wherein the network connection status of each response message is determined according to the IP address, the unique identification number, the timestamp, the packet sequence number and/or the data content of each response message, and the IP address in the response message with the best network connection status is selected as the IP address of the server, further comprising:
and if the IP addresses of the response messages are consistent and the unique identification numbers are consistent, taking the IP address in the response message as the IP address of the server.
4. A network service discovery method is applied to a server and is characterized by comprising the following steps:
receiving a broadcast message sent by a client;
when the port number of the broadcast message is consistent with the port number of the server, continuously sending a plurality of response messages, wherein the response messages comprise the network address, the unique identification number and the timestamp of the server, so that the client analyzes the plurality of response messages to obtain the IP address, the unique identification number and the timestamp of each response message; and judging the network connection state of each response message according to the IP address, the unique identification number and the timestamp of each response message, and selecting the IP address in the response message with the best network connection state as the IP address of the server, wherein the method comprises the following steps: judging the network connection state of each response message according to whether the time stamp and the sequence number of the data packet of each response message are continuous and/or the data content is complete; wherein, the data packet serial number and/or the data content are obtained by analyzing the response message; selecting the IP address in the response message with the earliest time as the IP address of the server for the first time; selecting an IP address with the best current network connection state according to a plurality of response messages received within a certain time; and if the IP address with the best current network connection state is different from the IP address with the best current actual connection state, switching the IP address with the best current actual connection state into the IP address with the best current network connection state.
5. The method according to claim 4, wherein the server includes a plurality of network card units, each of the network card units corresponds to a corresponding network address, each of the network card units transmits the response message, and each of the response messages includes a network address corresponding to a corresponding network card unit, a unique identification number of the server, and a timestamp of the corresponding network card unit transmitting the response message.
6. The method of claim 5, wherein the timestamp is accurate to the order of milliseconds or microseconds.
7. A client, comprising:
a first message sending module, configured to send a broadcast message, where the broadcast message includes a port number of a server;
the first message receiving module is used for continuously receiving a plurality of response messages sent by the server, wherein the response messages comprise the network address, the unique identification number and the timestamp of the server;
the message analysis module is used for analyzing the plurality of response messages to obtain the IP address, the unique identification number and the timestamp of each response message; judging the network connection state of each response message according to the IP address, the unique identification number and the timestamp of each response message, and selecting the IP address in the response message with the best network connection state as the IP address of the server, wherein the method comprises the following steps: judging the network connection state of each response message according to whether the time stamp and the sequence number of the data packet of each response message are continuous and/or the data content is complete; wherein, the data packet serial number and/or the data content are obtained by analyzing the response message; selecting the IP address in the response message with the earliest time as the IP address of the server for the first time; selecting an IP address with the best current network connection state according to a plurality of response messages received within a certain time; and if the IP address with the best current network connection state is different from the IP address with the best current actual connection state, switching the IP address with the best current actual connection state into the IP address with the best current network connection state.
8. The client of claim 7,
and the message analysis module is used for sorting the response messages according to the sequence of the timestamps when the IP addresses of the response messages are judged to be inconsistent and the unique identification numbers are judged to be consistent, and selecting the IP address in the response message with the earliest time as the IP address of the server.
9. The client according to claim 7, wherein the message parsing module is configured to, when it is determined that the IP addresses of the response messages are consistent and the unique identification numbers are consistent, use the IP address in the response message as the IP address of the server.
10. A server, comprising:
the second message receiving module is used for receiving the broadcast message sent by the client;
a second message sending module, configured to, when it is determined that the port number of the broadcast message is consistent with the port number of the server, continuously send multiple response messages, where the response messages include a network address, a unique identification number, and a timestamp of the server, so that the client parses the multiple response messages to obtain an IP address, a unique identification number, and a timestamp of each response message; and judging the network connection state of each response message according to the IP address, the unique identification number and the timestamp of each response message, and selecting the IP address in the response message with the best network connection state as the IP address of the server, wherein the method comprises the following steps: judging the network connection state of each response message according to whether the time stamp and the sequence number of the data packet of each response message are continuous and/or the data content is complete; wherein, the data packet sequence number and/or the data content are obtained by analyzing the response message; selecting the IP address in the response message with the earliest time as the IP address of the server for the first time; selecting an IP address with the best current network connection state according to a plurality of response messages received within a certain time; and if the IP address with the best current network connection state is different from the IP address with the best current actual connection state, switching the IP address with the best current actual connection state into the IP address with the best current network connection state.
11. The server according to claim 10, wherein the server includes a plurality of network card units, each of the network card units corresponds to a corresponding network address, each of the network card units transmits the response message, and each of the response messages includes a network address corresponding to a corresponding network card unit, the unique identification number of the server, and a timestamp of the corresponding network card unit transmitting the response message.
12. The server of claim 11, wherein the timestamp is accurate to the order of milliseconds or microseconds.
13. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 3 when executing the program.
14. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 4 to 6 when executing the program.
CN201910267813.XA 2019-04-03 2019-04-03 Network service discovery method, client, server and electronic equipment Active CN111385372B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910267813.XA CN111385372B (en) 2019-04-03 2019-04-03 Network service discovery method, client, server and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910267813.XA CN111385372B (en) 2019-04-03 2019-04-03 Network service discovery method, client, server and electronic equipment

Publications (2)

Publication Number Publication Date
CN111385372A CN111385372A (en) 2020-07-07
CN111385372B true CN111385372B (en) 2023-04-07

Family

ID=71219601

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910267813.XA Active CN111385372B (en) 2019-04-03 2019-04-03 Network service discovery method, client, server and electronic equipment

Country Status (1)

Country Link
CN (1) CN111385372B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09261274A (en) * 1996-03-19 1997-10-03 Toshiba Corp Network system using tcp/ip
CN104885428A (en) * 2012-12-31 2015-09-02 阿尔卡特朗讯公司 IP Address Based UDP Relay
CN107819893A (en) * 2017-10-27 2018-03-20 中航信移动科技有限公司 Network address Dynamic Configuration and mobile terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8334755B2 (en) * 2008-12-05 2012-12-18 Electronics And Telecommunications Research Institute Method for recognizing radio frequency identification tag reader and apparatus thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09261274A (en) * 1996-03-19 1997-10-03 Toshiba Corp Network system using tcp/ip
CN104885428A (en) * 2012-12-31 2015-09-02 阿尔卡特朗讯公司 IP Address Based UDP Relay
CN107819893A (en) * 2017-10-27 2018-03-20 中航信移动科技有限公司 Network address Dynamic Configuration and mobile terminal

Also Published As

Publication number Publication date
CN111385372A (en) 2020-07-07

Similar Documents

Publication Publication Date Title
US20190356596A1 (en) Service link selection control method and device
CN108810116B (en) Message processing method and related product
CN107786621B (en) User information management method, access processing method, device and system
CN113366815B (en) Network resource request method, device, electronic equipment and storage medium
CN111193815B (en) Domain name resolution method, domain name resolution device, computer readable storage medium and computer equipment
CN108418780A (en) Filter method and device, system, the dns server of IP address
CN112615753B (en) Link abnormity tracking method, first node, second node and link
CN112511366B (en) Test system, method, device, equipment and storage medium
CN107181825B (en) Online processing method of terminal equipment data
CN111355970A (en) Live broadcast management method and device and electronic equipment
CN104202432B (en) Remote web management system and management method
CN111385372B (en) Network service discovery method, client, server and electronic equipment
CN110781139A (en) Teaching plan resource management system and method and electronic equipment
CN109951549B (en) Network page access method and device and computer readable storage medium
CN111756817A (en) Device discovery method, device and computer-readable storage medium
CN114125024B (en) Audio transmission method, electronic device and readable storage medium
CN108289165B (en) Method and device for realizing camera control based on mobile phone and terminal equipment
CN112804102B (en) Equipment binding method, device and terminal
CN109479214B (en) Load balancing method and related device
CN111355767B (en) Remote control method, server, client and electronic equipment
CN114125023A (en) Data connection determining method and device, storage medium and electronic device
CN113628632A (en) Voice noise reduction method, device, equipment and storage medium
CN109688095B (en) Method, device and equipment for acquiring flow source information and readable storage medium
CN112953794A (en) Network detection method, device, equipment and storage medium of router
CN112637844A (en) Security authentication method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant