CN109150766A - The method and apparatus of dynamic addressing server in local area network based on UDP multicast - Google Patents

The method and apparatus of dynamic addressing server in local area network based on UDP multicast Download PDF

Info

Publication number
CN109150766A
CN109150766A CN201811219819.1A CN201811219819A CN109150766A CN 109150766 A CN109150766 A CN 109150766A CN 201811219819 A CN201811219819 A CN 201811219819A CN 109150766 A CN109150766 A CN 109150766A
Authority
CN
China
Prior art keywords
udp
client
server
port
multicast
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.)
Pending
Application number
CN201811219819.1A
Other languages
Chinese (zh)
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.)
Taihua Wisdom Industry Group Co Ltd
Original Assignee
Taihua Wisdom Industry Group 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 Taihua Wisdom Industry Group Co Ltd filed Critical Taihua Wisdom Industry Group Co Ltd
Priority to CN201811219819.1A priority Critical patent/CN109150766A/en
Publication of CN109150766A publication Critical patent/CN109150766A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/20Support for services
    • H04L49/201Multicast operation; Broadcast operation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/164Adaptation or special uses of UDP protocol

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a kind of method and apparatus of dynamic addressing server in local area network based on UDP multicast, include the following steps: S5: client sends the first UDP packet to local area network multicast domain and UDP multicast port, and the first UDP packet includes: client ip and UDP unicast port numbers;S6: server-side receives the first UDP packet;S7: server-side sends the 2nd UDP packet to client ip and UDP unicast port, and the 2nd UDP packet includes: server-side IP and service port number;S8: client receives the 2nd UDP packet;S9: client is carried out within n times by HTTP or Transmission Control Protocol with server-side and connects, and N is positive integer;S10: judge whether successful connection;If it fails to connect, then return step S5;If successful connection thens follow the steps S11: client is closed to UDP unicast port snoop, and leaves local area network multicast domain.Client can obtain server-side IP and service port number automatically, connect server-side automatically.

Description

The method and apparatus of dynamic addressing server in local area network based on UDP multicast
Technical field
The present invention relates to UDP technical field of multicast, more particularly, to dynamic in a kind of local area network based on UDP multicast The method and apparatus of addressable server.
Background technique
After the publication of local area network CS (client-server) software product, local area network deployment is essential link, especially It is the software product of multiple client (including pc client, cell phone client, Pad client etc.).
In local area network deployment software product, since network limits, the often server-side IP and server-side of each local area network Slogan can all change, and this uncertainty can bring extra workload to software implementation personnel.Software implementation at this stage Personnel often first need to set up server-side when disposing LAN software product, after the completion of erection determine server-side IP and Then service port number is manually arranged server-side IP and service port number in client and server-side is attached.
In the case where client is less, the workload of software implementation personnel is not counting very big, but if there is same office When there are many client terminal quantity in the net of domain, it is necessary to which software implementation personnel successively configure each client, give software implementation Personnel bring very big additional workload.
Summary of the invention
In view of this, the present invention provides a kind of method of dynamic addressing server in local area network based on UDP multicast and Device, to solve problem of the prior art.
The present invention provides a kind of methods of dynamic addressing server in local area network based on UDP multicast, including walk as follows It is rapid:
S1: local area network multicast domain is added in server-side;
S2: server-side monitors UDP multicast port;
S3: local area network multicast domain is added in client;
S4: client monitors UDP unicast port;
S5: client sends the first UDP packet to local area network multicast domain and UDP multicast port, and the first UDP packet includes: client Hold IP and UDP unicast port numbers;
S6: server-side receive the first UDP packet, according to protocol massages format parse the first UDP packet with obtain client ip with UDP unicast port numbers;
S7: server-side sends the 2nd UDP packet to client ip and UDP unicast port, and the 2nd UDP packet includes: server-side IP And service port number;
S8: client receive the 2nd UDP packet, according to protocol massages format parse the 2nd UDP packet with obtain server-side IP with Service port number;
S9: client is carried out within n times by HTTP or Transmission Control Protocol with server-side and connects, and N is positive integer;
S10: judge whether successful connection;
If it fails to connect, then return step S5;
If successful connection thens follow the steps S11: client is closed to UDP unicast port snoop, and leaves local area network group Broadcast domain.
Preferably, step S8 further include: by server-side IP and service port number storage into the local file of client.
Preferably, when the connection of client and server-side disconnects, following steps are executed:
S01: client reads server-side IP and service port number in local file;
Execute step S9.
Preferably, UDP multicast port includes UDP multicast conventional port and UDP multicast standby port, the spare end of UDP multicast The quantity of mouth is 1-5;
Step S2 is further are as follows: server-side monitors UDP multicast conventional port, if UDP multicast conventional port quilt It occupies, then server-side monitors UDP multicast standby port.
Preferably, further include following steps after step S7:
S71: judge whether client receives the 2nd UDP packet in preset time T;
If received, step S8 is executed;
If confiscated, step S72 is executed,
S72: UDP multicast conventional port is replaced with into UDP multicast standby port;Then step S5 is executed.
The present invention also provides a kind of devices of dynamic addressing server in local area network based on UDP multicast, comprising:
Server-side, client, network access device;
Server-side monitoring unit, for monitoring UDP multicast port;
Client monitoring unit, for monitoring UDP unicast port;
Client transmission unit, for sending the first UDP packet, the first UDP to UDP multicast port by network access device Packet includes: client ip and UDP unicast port numbers;
Server-side receiving unit parses the first UDP packet according to protocol massages format for receiving the first UDP packet to obtain Client ip and UDP unicast port numbers;
Server-side transmission unit, for sending the 2nd UDP packet, the 2nd UDP to UDP unicast port by network access device Packet includes: server-side IP and service port number;
Client receiving unit parses the 2nd UDP packet according to protocol massages format for receiving the 2nd UDP packet to obtain Server-side IP and service port number;
Connection unit is connected for client to be carried out within n times by HTTP or Transmission Control Protocol with server-side, and N is positive Integer;
Judging unit, for judging whether successful connection;
If it fails to connect, then client transmission unit is sent again through network access device to office's UDP multicast port First UDP packet;
If successful connection, client monitoring unit is closed to UDP unicast port snoop.
Preferably, client receiving unit includes: client storage unit, is obtained for parsing client receiving unit Server-side IP and service port number store into local file.
Preferably, further includes: whether monitoring unit, the connection for monitoring client and server-side disconnect;
If connection disconnects, connection unit reads server-side IP and service port number in local file, by client and Server-side re-connects.
Preferably, UDP multicast port includes UDP multicast conventional port and UDP multicast standby port, the spare end of UDP multicast The quantity of mouth is 1-5.
Preferably, network access device includes: router and interchanger.
Compared with prior art, in the local area network provided by the invention based on UDP multicast dynamic addressing server method And device, at least realize it is following the utility model has the advantages that
1, client can obtain server-side IP and service port number automatically, and client is made to connect server-side automatically.To Need not move through software implementation personnel depaly server-side IP and service port number, it is possible to reduce the work of software implementation personnel is promoted The joint efficiency of client and server-side.
2, when the change of later period network environment causes server-side IP and service port number to change, client can obtain automatically again Server-side IP and service port number are taken, client is made to restore the connection with server-side.To be further reduced software implementation personnel Work, promote the stability of the connection of client and server-side.
3, client is by server-side IP and service port number storage into the local file of client;When client and service When the connection at end disconnects, client reads server-side IP and service port number in local file, can quickly obtain service IP and service port number are held, connects client and server-side automatically again.
4, the number that client and server-side are attached is preset as n times, if it fails to connect, then client is mono- to UDP It broadcasts port and re-starts monitoring.When the change of later period network environment causes server-side IP and service port number to change, client can be with It obtains server-side IP and service port number automatically again again, client is made to restore the connection with server-side.To further subtract The work of few software implementation personnel, promotes the stability of the connection of client and server-side.
5, UDP multicast port includes UDP multicast conventional port and UDP multicast standby port, the number of UDP multicast standby port Amount is 1-5, and server-side monitors UDP multicast conventional port, if UDP multicast conventional port is occupied, services End is monitored by UDP multicast standby port.The particular number of UDP multicast standby port can according to specific business demand into Row setting, to be further ensured that reliability that client is connected with server-side.
6, after client sends the first UDP packet to local area network multicast domain and UDP multicast port, in preset time T, if Client does not receive the 2nd UDP packet, then client sends the first UDP packet to UDP multicast standby port, so as to further Guarantee the reliability that client is connected with server-side.
Certainly, implementing any of the products of the present invention specific needs while must not reach all the above technical effect.
By referring to the drawings to the detailed description of exemplary embodiment of the present invention, other feature of the invention and its Advantage will become apparent.
Detailed description of the invention
It is combined in the description and the attached drawing for constituting part of specification shows the embodiment of the present invention, and even With its explanation together principle for explaining the present invention.
Fig. 1 is the method for dynamic addressing server in a kind of local area network based on UDP multicast provided in an embodiment of the present invention Flow chart;
Fig. 2 is the side of dynamic addressing server in another local area network based on UDP multicast provided in an embodiment of the present invention Method flow chart;
Fig. 3 is the device of dynamic addressing server in a kind of local area network based on UDP multicast provided in an embodiment of the present invention Structure chart;
Specific embodiment
Carry out the various exemplary embodiments of detailed description of the present invention now with reference to attached drawing.It should also be noted that unless in addition having Body explanation, the unlimited system of component and the positioned opposite of step, numerical expression and the numerical value otherwise illustrated in these embodiments is originally The range of invention.
Be to the description only actually of at least one exemplary embodiment below it is illustrative, never as to the present invention And its application or any restrictions used.
Technology, method and apparatus known to person of ordinary skill in the relevant may be not discussed in detail, but suitable In the case of, the technology, method and apparatus should be considered as part of specification.
It is shown here and discuss all examples in, any occurrence should be construed as merely illustratively, without It is as limitation.Therefore, other examples of exemplary embodiment can have different values.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang Yi It is defined in a attached drawing, then in subsequent attached drawing does not need that it is further discussed.
Embodiment 1
Referring to FIG. 1, present embodiments providing a kind of side of dynamic addressing server in the local area network based on UDP multicast Method, comprising:
Step S1: local area network multicast domain is added in server-side;
Step S2: server-side monitors UDP multicast port;
Step S3: local area network multicast domain is added in client;
Step S4: client monitors UDP unicast port;
Step S5: client sends the first UDP packet to local area network multicast domain and UDP multicast port, and the first UDP packet includes: Client ip and UDP unicast port numbers;
Step S6: server-side receives the first UDP packet, parses the first UDP packet according to protocol massages format to obtain client IP and UDP unicast port numbers;
Step S7: server-side sends the 2nd UDP packet to client ip and UDP unicast port, and the 2nd UDP packet includes: service Hold IP and service port number;
Step S8: client receives the 2nd UDP packet, parses the 2nd UDP packet according to protocol massages format to obtain server-side IP and service port number;
Step S9: client is carried out within n times by HTTP or Transmission Control Protocol with server-side and connects, and N is positive integer;
Step S10: judge whether successful connection;
If it fails to connect, then return step S5;
If successful connection thens follow the steps S11: client is closed to UDP unicast port snoop, and leaves local area network group Broadcast domain.
The method for present embodiments providing dynamic addressing server in a kind of local area network based on UDP multicast is based on UDP group Technology is broadcast, multicast is the communication mode of " one-to-one group " between host, that is, joined same group of host and can receive All data in this group, interchanger and router in network are only to having demander to replicate and forward data needed for it.It is main Machine can be added to router solicitation or exit some group, and the router and interchanger in network selectively replicate and transmit number According to, i.e., will only organize in data be transferred to those and add enrolled host.Multiple in need (add can be once transferred data in this way Enter group) host, and can guarantee the host for not influencing that other do not need and (group are not added) other communication.
In step s 5, it includes client ip and UDP unicast that client is sent to local area network multicast domain and UDP multicast port First UDP packet of port numbers, the first UDP packet are packaged according to protocol massages format;In step s 6, server-side receives the first UDP Packet, and the first UDP packet is parsed to obtain client ip and UDP unicast port numbers;In the step s 7, server-side to client ip and UDP unicast port sends the 2nd UDP packet including server-side IP and service port number, and the 2nd UDP packet is according to protocol massages format It is packaged;In step s 8, client receives the 2nd UDP packet, and parses the 2nd UDP packet to obtain server-side IP and serve port Number, to realize that client can obtain server-side IP and service port number automatically, client is made to connect server-side automatically.
In step slo, judge whether successful connection, if it is judged that being "No", as connection failure then returns to step Rapid S5, client send the first UDP packet to local area network multicast domain and UDP multicast port again, to obtain server-side IP again And service port number.Server-side IP and service port number can be obtained automatically to further realize client, be further ensured that Client can be successfully connected to server-side.
The method of dynamic addressing server, needs not move through software in local area network provided in this embodiment based on UDP multicast Implement personnel depaly server-side IP and service port number, it is possible to reduce the work of software implementation personnel promotes client and service The joint efficiency at end.
Embodiment 2
Referring to FIG. 2, present embodiments providing the side of dynamic addressing server in another local area network based on UDP multicast Method, comprising:
Step S1: local area network multicast domain is added in server-side;
Step S2: server-side monitors UDP multicast conventional port, if UDP multicast conventional port is occupied, takes Business end is monitored by UDP multicast standby port;Wherein, UDP multicast port includes that UDP multicast conventional port and UDP multicast are standby With port, the quantity of UDP multicast standby port is 1-5;
Step S3: local area network multicast domain is added in client;
Step S4: client monitors UDP unicast port;
Step S5: client sends the first UDP packet to local area network multicast domain and UDP multicast port, and the first UDP packet includes: Client ip and UDP unicast port numbers;
Step S6: server-side receives the first UDP packet, parses the first UDP packet according to protocol massages format to obtain client IP and UDP unicast port numbers;
Step S7: server-side sends the 2nd UDP packet to client ip and UDP unicast port, and the 2nd UDP packet includes: service Hold IP and service port number;
Step S71: judge whether client receives the 2nd UDP packet in preset time T;
If received, step S8 is executed;
If confiscated, step S72 is executed,
Step S72: UDP multicast conventional port is replaced with into UDP multicast standby port;Then step S5 is executed;
Step S8: client receives the 2nd UDP packet, parses the 2nd UDP packet according to protocol massages format to obtain server-side IP and service port number;By server-side IP and service port number storage into the local file of client;
Step S9: client is carried out within n times by HTTP or Transmission Control Protocol with server-side and connects, and N is positive integer;
Step S10: judge whether successful connection;
If it fails to connect, then return step S5;
If successful connection thens follow the steps S11: client is closed to UDP unicast port snoop, and leaves local area network group Broadcast domain.
In method provided in this embodiment, after the completion of connecting for the first time, if the subsequent company for monitoring client and server-side When connecing disconnection, execute following steps: S01: client reads server-side IP and service port number in local file;Execute step S9。
In step s 8, client is by server-side IP and service port number storage into the local file of client;Work as prison When the connection of survey client and server-side disconnects, client can read server-side IP and service port number in local file, It re-connects.To can quickly obtain server-side IP and server-side after the connection of client and server-side disconnects Slogan connects client and server-side automatically again.
In the present embodiment, the number that client and server-side re-connect is preset as n times, client and server-side weight It is new to carry out n times connection, if it fails to connect, then client re-starts monitoring to UDP unicast port;N is positive integer.Work as client When the connection of end and server-side disconnects, client reads server-side IP and service port number in local file, client kimonos Business end re-starts n times connection, if it fails, then return step S5, client retransmits the first UDP packet, again for n-th connection It is new to obtain server-side IP and service port number.When the change of later period network environment causes server-side IP and service port number to change, visitor Family end can obtain server-side IP and service port number automatically again again, and client is made to restore the connection with server-side.To It is further reduced the work of software implementation personnel, promotes the stability of the connection of client and server-side.
In the present embodiment, UDP multicast port includes UDP multicast conventional port and UDP multicast standby port, and UDP multicast is standby It is 1-5 with the quantity of port;Server-side monitor to UDP multicast port: server-side is normal to UDP multicast Rule port is monitored, if UDP multicast conventional port is occupied, server-side monitors UDP multicast standby port. UDP multicast conventional port and UDP multicast standby port need the agreement before product is issued, for example, UDP multicast standby port can be with For 1,2,3,4,5, the particular number of UDP multicast standby port can be set according to specific business demand It sets, to be further ensured that reliability that client is connected with server-side.
In the present embodiment, after client sends the first UDP packet to local area network multicast domain and UDP multicast port, when default Between in T, if client does not receive the 2nd UDP packet, UDP multicast conventional port is replaced with into UDP multicast standby port, weight It is new to execute step S5.For example, preset time T can be 30S, in 30S, if client does not receive the of server-side transmission Two UDP packets, client do not receive the first UDP packet depending on server-side, then client sends the first UDP to UDP multicast standby port Packet, return step S5.So as to be further ensured that reliability that client is connected with server-side.
Embodiment 3
Referring to FIG. 3, present embodiments providing a kind of dress of dynamic addressing server in the local area network based on UDP multicast It sets, comprising:
Server-side 100, client 200, network access device 300;
Server-side monitoring unit 10, for monitoring UDP multicast port;
Client monitoring unit 20, for monitoring UDP unicast port;
Client transmission unit 30, for sending the first UDP packet to UDP multicast port by network access device 300, the One UDP packet includes: client ip and UDP unicast port numbers;
Server-side receiving unit 40 parses the first UDP packet according to protocol massages format for receiving the first UDP packet to obtain Obtain client ip and UDP unicast port numbers;
Server-side transmission unit 50, for sending the 2nd UDP packet to UDP unicast port by network access device 300, the Two UDP packets include: server-side IP and service port number;
Client receiving unit 60 parses the 2nd UDP packet according to protocol massages format for receiving the 2nd UDP packet to obtain Obtain server-side IP and service port number;Client receiving unit 60 includes: client storage unit 61, for receiving client The server-side IP and service port number that the parsing of unit 60 obtains are stored into local file.
Connection unit 70, for connecting client by HTTP or Transmission Control Protocol at most n times with server-side, N is positive whole Number;
Judging unit 80, for judging whether successful connection;
If it fails to connect, then client transmission unit 30 is sent out again through network access device 300 to UDP multicast port Send the first UDP packet;
If successful connection, client monitoring unit 20 is closed to UDP unicast port snoop.
In the present embodiment, be also provided with: monitoring unit 62, for monitor client 200 and server-side 100 connection whether It disconnects;
If connection disconnects, connection unit 70 reads server-side IP and service port number in local file, by client 200 and server-side 100 re-connect.
In the present embodiment, UDP multicast port includes UDP multicast conventional port and UDP multicast standby port, and UDP multicast is standby It is 1-5 with the quantity of port.
In the present embodiment, network access device includes: router and interchanger.
In local area network provided in this embodiment based on UDP multicast in the device of dynamic addressing server, client 200 can To obtain the server-side IP and service port number of server-side 100 automatically, make the connection server-side 100 automatically of client 200.
Also, judging unit 80 can decide whether successful connection, if it is judged that for "No", as connection failure, Then client transmission unit 30 sends the first UDP packet to UDP multicast port again through network access device 300, thus again Obtain server-side IP and service port number.Server-side IP and serve port can be obtained automatically to further realize client Number, it is further ensured that client can be successfully connected to server-side.
The device of dynamic addressing server, needs not move through software in local area network provided in this embodiment based on UDP multicast Implement personnel depaly server-side IP and service port number, it is possible to reduce the work of software implementation personnel promotes client and service The joint efficiency at end.
In the present embodiment, client receiving unit 60 includes being also provided with client storage unit 61, is used for client The server-side IP and service port number that the parsing of receiving unit 60 obtains are stored into local file, when monitoring 200 kimonos of client Be engaged in end 100 connection disconnect when, connection unit 70 can read server-side IP and service port number in local file, again into Row connection.To can quickly obtain server-side IP and service port number, make after the connection of client and server-side disconnects Client and server-side connect automatically again.
In the present embodiment, the number that client and server-side are attached is preset as n times, and client and server-side carry out N Secondary connection, if it fails to connect, then client re-starts monitoring, as 30 weight of client transmission unit to UDP unicast port It is new to send the first UDP packet, to reacquire server-side IP and service port number.Lead to server-side in the change of later period network environment When IP and service port number change, client can obtain server-side IP and service port number automatically again again, make client Restore the connection with server-side.To be further reduced the work of software implementation personnel, the connection of client and server-side is promoted Stability.
In the present embodiment, UDP multicast conventional port and UDP multicast standby port need the agreement before product is issued, for example, UDP multicast standby port can be 1,2,3,4,5, and the particular number of UDP multicast standby port can be according to tool The business demand of body is configured, to be further ensured that reliability that client is connected with server-side.
Through the foregoing embodiment it is found that dynamic addressing server in the local area network provided by the invention based on UDP multicast Method and apparatus, at least realize it is following the utility model has the advantages that
1, client can obtain server-side IP and service port number automatically, and client is made to connect server-side automatically.To Need not move through software implementation personnel depaly server-side IP and service port number, it is possible to reduce the work of software implementation personnel is promoted The joint efficiency of client and server-side.
2, when the change of later period network environment causes server-side IP and service port number to change, client can obtain automatically again Server-side IP and service port number are taken, client is made to restore the connection with server-side.To be further reduced software implementation personnel Work, promote the stability of the connection of client and server-side.
3, client is by server-side IP and service port number storage into the local file of client;When client and service When the connection at end disconnects, client reads server-side IP and service port number in local file, can quickly obtain service IP and service port number are held, connects client and server-side automatically again.
4, the number that client and server-side are attached is preset as n times, if it fails to connect, then client is mono- to UDP It broadcasts port and re-starts monitoring.When the change of later period network environment causes server-side IP and service port number to change, client can be with It obtains server-side IP and service port number automatically again again, client is made to restore the connection with server-side.To further subtract The work of few software implementation personnel, promotes the stability of the connection of client and server-side.
5, UDP multicast port includes UDP multicast conventional port and UDP multicast standby port, the number of UDP multicast standby port Amount is 1-5, and server-side monitors UDP multicast conventional port, if UDP multicast conventional port is occupied, services End is monitored by UDP multicast standby port.The particular number of UDP multicast standby port can according to specific business demand into Row setting, to be further ensured that reliability that client is connected with server-side.
6, after client sends the first UDP packet to local area network multicast domain and UDP multicast port, in preset time T, if Client does not receive the 2nd UDP packet, then client sends the first UDP packet to UDP multicast standby port, so as to further Guarantee the reliability that client is connected with server-side.
Although some specific embodiments of the invention are described in detail by example, the skill of this field Art personnel it should be understood that example above merely to being illustrated, the range being not intended to be limiting of the invention.The skill of this field Art personnel are it should be understood that can without departing from the scope and spirit of the present invention modify to above embodiments.This hair Bright range is defined by the following claims.

Claims (10)

1. a kind of method of dynamic addressing server in local area network based on UDP multicast, which comprises the steps of:
S1: local area network multicast domain is added in server-side;
S2: the server-side monitors UDP multicast port;
S3: local area network multicast domain is added in client;
S4: the client monitors UDP unicast port;
S5: the client sends the first UDP packet, the first UDP to the local area network multicast domain and the UDP multicast port Packet includes: client ip and the UDP unicast port numbers;
S6: the server-side receives the first UDP packet, parses the first UDP packet according to protocol massages format to obtain State client ip and the UDP unicast port numbers;
S7: the server-side sends the 2nd UDP packet, the 2nd UDP packet to the client ip and UDP unicast port It includes: server-side IP and service port number;
S8: the client receives the 2nd UDP packet, parses the 2nd UDP packet according to protocol massages format to obtain State server-side IP and the service port number;
S9: the client is carried out within n times by HTTP or Transmission Control Protocol with the server-side and connects, and N is positive integer;
S10: judge whether successful connection;
If it fails to connect, then return step S5;
If successful connection thens follow the steps S11: the client is closed to the UDP unicast port snoop, and is left described Local area network multicast domain.
2. the method according to claim 1, wherein
Step S8 further include: by the server-side IP and service port number storage into the local file of the client.
3. according to the method described in claim 2, it is characterized in that,
When the connection of the client and the server-side disconnects, following steps are executed:
S01: the client reads the server-side IP and the service port number in the local file;
Execute step S9.
4. the method according to claim 1, wherein
The UDP multicast port includes UDP multicast conventional port and UDP multicast standby port, the UDP multicast standby port Quantity is 1-5;
Step S2 is further are as follows: the server-side monitors UDP multicast conventional port, if the UDP multicast conventional end Mouth is occupied, then the server-side monitors UDP multicast standby port.
5. according to the method described in claim 4, it is characterized in that,
Further include following steps after step S7:
S71: judge whether the client receives the 2nd UDP packet in preset time T;
If received, step S8 is executed;
If confiscated, step S72 is executed,
S72: the UDP multicast conventional port is replaced with into UDP multicast standby port;Then step S5 is executed.
6. the device of dynamic addressing server in a kind of local area network based on UDP multicast characterized by comprising
Server-side, client, network access device;
Server-side monitoring unit, for monitoring UDP multicast port;
Client monitoring unit, for monitoring UDP unicast port;
Client transmission unit, for sending the first UDP packet, institute to the UDP multicast port by the network access device Stating the first UDP packet includes: client ip and the UDP unicast port numbers;
Server-side receiving unit, for receiving the first UDP packet, according to protocol massages format parse the first UDP packet with Obtain the client ip and the UDP unicast port numbers;
Server-side transmission unit, for sending the 2nd UDP packet, institute to UDP unicast port by the network access device Stating the 2nd UDP packet includes: server-side IP and service port number;
Client receiving unit, for receiving the 2nd UDP packet, according to protocol massages format parse the 2nd UDP packet with Obtain the server-side IP and the service port number;
Connection unit connects, N for the client to be carried out within n times by HTTP or Transmission Control Protocol with the server-side For positive integer;
Judging unit, for judging whether successful connection;
If it fails to connect, then the client transmission unit is again through the network access device to UDP multicast end Mouth sends the first UDP packet;
If successful connection, the client monitoring unit is closed to the UDP unicast port snoop.
7. device according to claim 6, which is characterized in that
The client receiving unit includes: client storage unit, for obtain client receiving unit parsing The server-side IP and service port number storage are into local file.
8. device according to claim 7, which is characterized in that further include:
Whether monitoring unit, the connection for monitoring the client and the server-side disconnect;
If connection disconnects, the connection unit reads the server-side IP and the serve port in the local file Number, the client and the server-side are re-connected.
9. device according to claim 6, which is characterized in that
The UDP multicast port includes UDP multicast conventional port and UDP multicast standby port, the UDP multicast standby port Quantity is 1-5.
10. device according to claim 6, which is characterized in that
The network access device includes: router and interchanger.
CN201811219819.1A 2018-10-19 2018-10-19 The method and apparatus of dynamic addressing server in local area network based on UDP multicast Pending CN109150766A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811219819.1A CN109150766A (en) 2018-10-19 2018-10-19 The method and apparatus of dynamic addressing server in local area network based on UDP multicast

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811219819.1A CN109150766A (en) 2018-10-19 2018-10-19 The method and apparatus of dynamic addressing server in local area network based on UDP multicast

Publications (1)

Publication Number Publication Date
CN109150766A true CN109150766A (en) 2019-01-04

Family

ID=64808819

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811219819.1A Pending CN109150766A (en) 2018-10-19 2018-10-19 The method and apparatus of dynamic addressing server in local area network based on UDP multicast

Country Status (1)

Country Link
CN (1) CN109150766A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110049010A (en) * 2019-03-12 2019-07-23 广州市保伦电子有限公司 A kind of method and system of distributed platform terminal device connection server
CN110995850A (en) * 2019-12-11 2020-04-10 武汉卓讯互动信息科技有限公司 MIDI multi-device access processing method
CN111163190A (en) * 2020-01-14 2020-05-15 上海曼恒数字技术股份有限公司 Method and system for acquiring server IP (Internet protocol) from cross-network segment
CN114726673A (en) * 2022-03-22 2022-07-08 深圳渊联技术有限公司 Modbus TCP protocol communication method and communication system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040095897A1 (en) * 2002-11-14 2004-05-20 Digi International Inc. System and method to discover and configure remotely located network devices
CN101075898A (en) * 2007-05-31 2007-11-21 四川长虹电器股份有限公司 Method for searching network equipment and service
CN103441938A (en) * 2013-08-28 2013-12-11 南车株洲电力机车研究所有限公司 Port switching method and communication equipment
CN104618375A (en) * 2015-01-30 2015-05-13 普联技术有限公司 Method and device for discovering network devices
US9350559B2 (en) * 2014-06-16 2016-05-24 Asurion, Llc Service discovery across different networks
CN105657040A (en) * 2016-02-17 2016-06-08 深圳市贝美互动科技有限公司 Inter-device intranet communication method and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040095897A1 (en) * 2002-11-14 2004-05-20 Digi International Inc. System and method to discover and configure remotely located network devices
WO2004045139A2 (en) * 2002-11-14 2004-05-27 Digi International Inc. System and method for discovery and configuration
CN101075898A (en) * 2007-05-31 2007-11-21 四川长虹电器股份有限公司 Method for searching network equipment and service
CN103441938A (en) * 2013-08-28 2013-12-11 南车株洲电力机车研究所有限公司 Port switching method and communication equipment
US9350559B2 (en) * 2014-06-16 2016-05-24 Asurion, Llc Service discovery across different networks
CN104618375A (en) * 2015-01-30 2015-05-13 普联技术有限公司 Method and device for discovering network devices
CN105657040A (en) * 2016-02-17 2016-06-08 深圳市贝美互动科技有限公司 Inter-device intranet communication method and system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110049010A (en) * 2019-03-12 2019-07-23 广州市保伦电子有限公司 A kind of method and system of distributed platform terminal device connection server
CN110049010B (en) * 2019-03-12 2022-03-08 广州市保伦电子有限公司 Method and system for connecting distributed platform terminal equipment with server
CN110995850A (en) * 2019-12-11 2020-04-10 武汉卓讯互动信息科技有限公司 MIDI multi-device access processing method
CN111163190A (en) * 2020-01-14 2020-05-15 上海曼恒数字技术股份有限公司 Method and system for acquiring server IP (Internet protocol) from cross-network segment
CN114726673A (en) * 2022-03-22 2022-07-08 深圳渊联技术有限公司 Modbus TCP protocol communication method and communication system
CN114726673B (en) * 2022-03-22 2023-10-31 深圳渊联技术有限公司 Modbus TCP protocol communication method and communication system

Similar Documents

Publication Publication Date Title
CN109150766A (en) The method and apparatus of dynamic addressing server in local area network based on UDP multicast
DE69922690T2 (en) FAULT TOLERANT NETWORKS
CN103873472A (en) Method for automatically having access to network
CN109617731A (en) Adaptive gateway role configuration method and device under a kind of multi-gateway environment
EP3264810A1 (en) Perception-free authentication method and system, and control method and system based on method
CN105099898B (en) A kind of PPPOE message forwarding methods and BRAS servers
CN106961426B (en) Communication method and device of intelligent equipment
CN108847976B (en) Distribution network control method, mobile terminal, device and computer readable storage medium
CN104468869B (en) For the method for terminal distribution IP address, the method and device of acquisition IP address
CN103916424B (en) A kind of method, communication terminal and the communication network of management and control application program heartbeat packet
CN106936943A (en) The distribution method and system of virtual machine address
CN103117935A (en) Multicast data forwarding method and multicast data forwarding device applied to multi-homing networking
CN106131235A (en) A kind of IP address configuration method
CN106453231A (en) Signaling obtaining and transmission method and device
CN109167762A (en) A kind of IEC104 message checking method and device
CN103561122B (en) IPv6 address collocation method, IPv6 client and server
US20010010061A1 (en) Communication system, communication method, gateway apparatus, and client
CN101534257B (en) Method, system and equipment for processing message
CN107613023B (en) Equipment connection method and device
CN104734952A (en) Data message forwarding method and device
CN104301449A (en) Method and device for modifying IP address
CN103401954B (en) The implementation method of virtual DHCP
CN106375211B (en) Exchange data processing method and interchanger in VRRP load-balancing scenario
CN102447703B (en) A kind of heat backup method and system, CGN equipment
CN103873335B (en) Dialing method of terminal equipment, and access equipment

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190104