The automatic connection method of a kind of host computer and slave computer
Technical field
The present invention relates to the automatic connection method of a kind of host computer and slave computer.
Background technology
At present, existing technology is to realize the connection of host computer and slave computer, need the IP address knowing host computer and slave computer at least one party, this just needs artificial IP address of adding the opposing party a side, just can connect, or sending TCP connection request one by one to obtain connection to the IP address of the whole network section, such efficiency comparison is low, connects too slow.
Summary of the invention
For solving the problem, the object of the present invention is to provide a kind of can and the method that ignorant situation in realize from be dynamically connected mutual in the address of host computer and slave computer.
The present invention solves the technical scheme that its problem adopts: the automatic connection method of a kind of host computer and slave computer, comprises host computer and slave computer, said method comprising the steps of:
A, slave computer obtain own IP address by DHCP, represent that the character of udp broadcast request is gone out with regard to udp broadcast at set intervals by one;
B, host computer start UDP parsing module, read broadcast message, differentiate whether character is the character that slave computer defines; If just resolve the IP address of this UDP information, and send a UDP return information to this IP address, the information content is defined by host computer oneself; If not just abandoning this UDP information;
After C, slave computer receive UDP return information, differentiate this information return information whether host computer defines; If just stop udp broadcast, resolve the IP address of host computer UDP return information, set up TCP with this IP address and be connected; If not just continuing to send udp broadcast at set intervals.
Preferably, described steps A comprises: the character definition of expression udp broadcast request is 1.
Further, described steps A comprises: in network, all devices all can receive the data message of slave computer broadcast, but only has the parsing module being just provided with in host computer and can resolving this data message.
Preferably, described step B comprises: host computer UDP return information is content-defined is 2.
Further, host computer is the main frame of broadcast system, and slave computer is the stereo set of broadcast system.
The invention has the beneficial effects as follows: the automatic connection method of a kind of host computer that the present invention adopts and slave computer, can be mutual and realize in ignorant situation from being dynamically connected in the address of host computer and slave computer, arrange without the need to manually participating in, utilize udp broadcast simultaneously and reply the data message with differentiating character, by differentiating that the IP address obtaining the other side can be resolved in character, UDP information is simple, and connection speed is fast, efficiency is high, and stability, fail safe are high.
Accompanying drawing explanation
Below in conjunction with accompanying drawing and example, the invention will be further described.
Fig. 1 is the particular flow sheet of the automatic connection method of a kind of host computer of the present invention and slave computer.
Embodiment
With reference to Fig. 1, the automatic connection method of a kind of host computer of the present invention and slave computer, the automatic connection method of a kind of host computer and slave computer, comprises host computer and slave computer, said method comprising the steps of:
A, slave computer obtain own IP address by DHCP, represent that the character of udp broadcast request is gone out with regard to udp broadcast at set intervals by one;
B, host computer start UDP parsing module, read broadcast message, differentiate whether character is the character that slave computer defines; If just resolve the IP address of this UDP information, and send a UDP return information to this IP address, the information content is defined by host computer oneself; If not just abandoning this UDP information;
After C, slave computer receive UDP return information, differentiate this information return information whether host computer defines; If just stop udp broadcast, resolve the IP address of host computer UDP return information, set up TCP with this IP address and be connected; If not just continuing to send udp broadcast at set intervals.
Slave computer is by dynamic obtaining IP address (DHCP), and send specific data message to place local area network (LAN) udp broadcast, specific identifier is had in data message, then in network, all devices all can receive data message, but only have the parsing module being just provided with in host computer and can resolving this data message, host computer passes through resolution data, determine the object of these data, then the IP address that the address information changing data gets slave computer is resolved, and then send UDP return information by this address to slave computer, after slave computer receives return information, resolve the address of this information, obtain the IP address of host computer, and then connect with host computer TCP/IP, realize certainly being dynamically connected of host computer and slave computer.
Described steps A comprises: the character definition of expression udp broadcast request is 1.
Described steps A comprises: in network, all devices all can receive the data message of slave computer broadcast, but only has the parsing module being just provided with in host computer and can resolving this data message.
Described step B comprises: host computer UDP return information is content-defined is 2.
Host computer is the main frame of broadcast system, and slave computer is the stereo set of broadcast system.Host computer of the present invention and slave computer automatic connection method are specially adapted to use in broadcast control system, wherein slave computer is that intelligence plays stereo set, intelligent audio broadcast is carried out from the control signal of broadcast host by receiving, when when setting up radio network, only need that intelligence is play stereo set and be connected to network, automatically can be connected with broadcast host, staff scene is not needed to carry out debugging coupling to equipment, really achieve the plug and play of broadcasting equipment, greatly save installation, the time of debugging, operating process is very simple, the staff of specialty is not needed to get final product complete operation.
This invention can realize the intelligence of a kind of host computer and slave computer from being dynamically connected, open upper computer software on computers, slave computer powers on, connect netting twine, just can on being dynamically connected, and when after host computer IP address modification, only need restart slave computer can connect at once, slave computer at any time access network can connect fast, this is a kind of without the need to manually participating in the connection arranged, and connection speed is fast, and efficiency is high.
The above, just preferred embodiment of the present invention, the present invention is not limited to above-mentioned execution mode, as long as it reaches technique effect of the present invention with identical means, all should belong to protection scope of the present invention.