CN115643268A - Method, device and system for realizing local area network master-slave computer communication protocol - Google Patents

Method, device and system for realizing local area network master-slave computer communication protocol Download PDF

Info

Publication number
CN115643268A
CN115643268A CN202211295505.6A CN202211295505A CN115643268A CN 115643268 A CN115643268 A CN 115643268A CN 202211295505 A CN202211295505 A CN 202211295505A CN 115643268 A CN115643268 A CN 115643268A
Authority
CN
China
Prior art keywords
slave
broadcast information
host
information
local area
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
CN202211295505.6A
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.)
Chengdu Ebyte Electronic Technology Co ltd
Original Assignee
Chengdu Ebyte Electronic Technology 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 Chengdu Ebyte Electronic Technology Co ltd filed Critical Chengdu Ebyte Electronic Technology Co ltd
Priority to CN202211295505.6A priority Critical patent/CN115643268A/en
Publication of CN115643268A publication Critical patent/CN115643268A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention belongs to the technical field of communication, and relates to a method, a device and a system for realizing a local area network master-slave computer communication protocol based on a UDP protocol, wherein the method comprises the following steps: after the host accesses the local area network, first broadcast information is sent to ports of each slave device; all slave devices supporting the protocol of the first broadcast information send second broadcast information to the port of the host after receiving the first broadcast information; the host stores the second broadcast information; when the host sends a data instruction to the slave equipment, adding second broadcast information in front of the message; and when the slave equipment in the local area network receives the message, comparing the second broadcast information with the parameter information of the slave equipment and replying to the host. The invention realizes the point-to-point communication between the host and the slave in the local area network; the host and the slave devices can communicate across network segments, the host does not need to know the IP addresses of the slave devices in advance, and the communication of the master device and the slave device cannot be influenced by the IP address conflict of the plurality of slave devices.

Description

Method, device and system for realizing local area network master-slave computer communication protocol
Technical Field
The invention belongs to the technical field of communication, and particularly relates to a method, a device and a system for realizing a communication protocol of a master machine and a slave machine of a local area network.
Background
As internet of things equipment is used more and more widely in various industries, the number of the internet of things equipment is more and more, the internet of things equipment usually cannot integrate a human-computer interface, and a mode for conveniently checking network information of the internet of things equipment is not available, or because factory settings are the same, the problem of IP conflict easily occurs, so that the network information can be checked in the same local area network, if more internet of things equipment are mounted, if a certain equipment is required to be configured or checked, the connection between a host and the equipment needs to be established by using a TCP protocol, the IP address of the equipment needs to be known in advance, which is a difficult thing in an environment with complicated equipment site; if the UDP broadcast is used, although data of the host can reach the device, the host cannot interact with the device with unknown IP address in the single-lan, and perform parameter configuration on the device.
Disclosure of Invention
In order to solve the above technical problems, the present invention provides a method, an apparatus and a system for implementing a communication protocol between a master and a slave of a local area network.
In a first aspect, the present disclosure provides a method for implementing a local area network master-slave communication protocol, including:
the master lookup slave device comprises:
after the host accesses the local area network, first broadcast information is sent to ports of each slave device;
after receiving the first broadcast information, all the slave devices in the local area network which support the protocol of the first broadcast information send second broadcast information to the port of the host;
the host saves the second broadcast information;
the point-to-point communication between the master and the slave device comprises:
when the host sends a data instruction to the slave equipment, the second broadcast information is added in front of the message;
and when the slave equipment in the local area network receives the message, comparing the second broadcast information with the parameter information of the slave equipment, if the second broadcast information is the same as the parameter information of the slave equipment, replying the master machine by the slave equipment according to the data instruction, otherwise, if the second broadcast information is not the same as the parameter information of the slave equipment, not replying the master machine by the slave equipment.
In a second aspect, the present disclosure provides a device for implementing a local area network master-slave communication protocol, including:
a host; the host includes:
the first sending unit is used for sending first broadcast information to the ports of the slave devices after the host machine is accessed to the local area network;
a first storage unit for storing first broadcast information; the first broadcast information includes parameter information of the slave device;
when the host sends a data instruction to the slave equipment, adding second broadcast information in front of the message; the second broadcast information is parameter information of the slave device supporting a protocol of the first broadcast information;
the first receiving unit is used for receiving data replied by the slave equipment;
a slave device; the slave device includes:
a second receiving unit for receiving the first broadcast information;
a second storage unit for storing second broadcast information;
a comparing unit, configured to compare the second broadcast information with parameter information of the slave device when the slave device in the local area network receives the packet, where if the second broadcast information is the same as the parameter information of the slave device, the slave device replies to the host according to the data instruction, and otherwise, if the second broadcast information is not the same as the parameter information of the slave device, the slave device does not reply to the host;
and the second sending unit is used for sending second broadcast information to the port of the host after receiving the first broadcast information, and replying the host according to the data instruction after the second broadcast information is compared with the parameter information of the host.
In a third aspect, the present disclosure provides a system for implementing a local area network master-slave communication protocol, including at least one processor and a memory:
the memory to store one or more program instructions;
the processor is used for running one or more program instructions and executing the method for realizing the communication protocol of the local area network master-slave machine.
The invention has the beneficial effects that: the invention realizes the point-to-point communication of the network equipment in the local area network; the host and the slave devices can communicate across network segments, the host does not need to know the IP addresses of the slave devices in advance, and the communication of the master device and the slave device cannot be influenced by the conflict of the IP addresses of the multiple slave devices.
On the basis of the technical scheme, the invention can be further improved as follows.
Further, the protocols of the first broadcast information and the second broadcast information are both user datagram protocols.
Further, the first broadcast information includes parameter information of the slave device.
Further, the second broadcast information is parameter information of the slave device supporting a protocol of the first broadcast information.
Further, the parameter information of the slave device includes MAC address information and device model information.
Drawings
Fig. 1 is a schematic diagram of a master lookup slave device according to embodiment 1 of the present invention;
fig. 2 is a schematic diagram of a device for implementing a communication protocol between a master and a slave in a lan according to embodiment 2 of the present invention;
fig. 3 is a schematic diagram of a lan master-slave communication protocol implementation system according to embodiment 3 of the present invention.
Icon: 1-a host; 2-a slave; 101-a first sending unit; 102-a first storage unit; 103-a first receiving unit; 201-a second receiving unit; 202-a second storage unit; 203-a comparison unit; 204-a second sending unit; 301-a processor; 302-memory.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Example 1
As an embodiment, as shown in fig. 1, to solve the above technical problem, the present embodiment provides a method for implementing a local area network master-slave communication protocol, including:
the master lookup slave device comprises:
after the host accesses the local area network, first broadcast information is sent to ports of each slave device;
all slave devices supporting the protocol of the first broadcast information in the local area network send second broadcast information to a port of the host after receiving the first broadcast information;
the host stores the second broadcast information;
the point-to-point communication between the host and the slave equipment comprises the following steps:
when the host sends a data instruction to the slave equipment, adding second broadcast information in front of the message;
when the slave equipment in the local area network receives the message, the second broadcast information is compared with the parameter information of the slave equipment, if the second broadcast information is the same as the parameter information of the slave equipment, the slave equipment replies the host according to the data instruction, otherwise, if the second broadcast information is not the same as the parameter information of the slave equipment, the slave equipment does not reply the host.
Optionally, the protocols of the first broadcast information and the second broadcast information are both user datagram protocols.
The UDP (User Datagram Protocol) Protocol is a network Protocol based on an IP Protocol, which is called a User Datagram Protocol, like the TCP (Transmission Control Protocol) Protocol. UDP provides a way for applications to send encapsulated IP packets without establishing a connection.
Optionally, the first broadcast information includes parameter information of the slave device.
Optionally, the second broadcast information is parameter information of a slave device supporting a protocol of the first broadcast information.
Optionally, the parameter information of the slave device includes MAC address information and device model information.
The invention realizes the point-to-point communication of the network equipment in the local area network; the host and the slave devices can communicate across network segments, the host does not need to know the IP addresses of the slave devices in advance, and the communication of the master device and the slave device cannot be influenced by the conflict of the IP addresses of the multiple slave devices.
Example 2
Based on the same principle as the method shown in embodiment 1 of the present invention, as shown in fig. 2, an embodiment of the present invention further provides a device for implementing a local area network master-slave communication protocol, including:
a host; the host computer includes:
a first sending unit 101, which sends first broadcast information to the ports of each slave device after the host accesses the local area network;
a first storage unit 102 for storing first broadcast information; the first broadcast information includes parameter information of the slave device;
when the host sends a data instruction to the slave equipment, second broadcast information is added in front of the message; the second broadcast information is parameter information of slave equipment of a protocol supporting the first broadcast information;
a first receiving unit 103, configured to receive data replied by the slave device;
a slave device; the slave device includes:
a second receiving unit 201 for receiving the first broadcast information;
a second storage unit 202 for storing second broadcast information;
a comparing unit 203, configured to compare the second broadcast information with the parameter information of the slave device when the slave device in the local area network receives the message, and if the second broadcast information is the same as the parameter information of the slave device, the slave device replies to the host according to the data instruction, otherwise, if the second broadcast information is not the same as the parameter information of the slave device, the slave device does not reply to the host;
the second sending unit 204 is configured to send the second broadcast information to the port of the host after receiving the first broadcast information, and reply to the host according to the data instruction after the second broadcast information is compared with the parameter information of the host.
Optionally, the protocols of the first broadcast information and the second broadcast information are both user datagram protocols.
Optionally, the first broadcast information includes parameter information of the slave device.
Optionally, the second broadcast information is parameter information of a slave device supporting a protocol of the first broadcast information.
Optionally, the parameter information of the slave device includes MAC address information and device model information.
The working principle of the device for realizing the communication protocol of the master and slave computers of the local area network comprises the following steps:
the host searches for the device:
after the host accesses the local area network, the host sends broadcast information, after all the devices supporting the protocol in the local area network receive the broadcast information, the information about the devices, including MAC (media access control), device models and the like, is broadcasted to the host port, and the host stores the information independently for the subsequent point-to-point communication between the host and the slave devices.
Point-to-point communication between the host and the slave:
the method is characterized in that UDP broadcast communication is carried out between a host and a slave, data respectively sent by the host and the slave is received by network equipment in a local area network, when the host sends data to the slave, parameters of the slave such as MAC addresses are added in front of messages, so that after the slave in the local area network receives the messages, the MAC addresses in the messages are firstly compared with the MAC addresses of the slave, if the MAC addresses are different, responses are not carried out, if the MAC addresses are the same, the host is replied according to instructions in a protocol, and point-to-point communication between the host and the network equipment in the local area network is realized through UDP broadcast.
The invention realizes the point-to-point communication of the network equipment in the local area network; the host and the slave equipment can communicate across network segments, the host does not need to know the IP addresses of the slave equipment in advance, and the communication of the master equipment and the slave equipment cannot be influenced by the conflict of the IP addresses of a plurality of slave equipment.
Example 3
Based on the same principle as the method shown in embodiment 1 of the present invention, as shown in fig. 3, an embodiment of the present invention further provides a local area network master-slave communication protocol implementation system, which includes at least one processor 301 and a memory 302:
a memory 301 for storing one or more program instructions;
the processor 302 is configured to execute one or more program instructions to perform a method for implementing a lan master-slave communication protocol.
The invention realizes the point-to-point communication of the network equipment in the local area network; the host and the slave devices can communicate across network segments, the host does not need to know the IP addresses of the slave devices in advance, and the communication of the master device and the slave device cannot be influenced by the conflict of the IP addresses of the multiple slave devices.
The present invention has been described in terms of the preferred embodiment, and it is not intended to be limited to the embodiment. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (7)

1. The method for realizing the communication protocol of the local area network master and slave machines is characterized by comprising the following steps:
the master lookup slave device comprises:
after the host accesses the local area network, first broadcast information is sent to ports of each slave device;
after receiving the first broadcast information, all the slave devices in the local area network which support the protocol of the first broadcast information send second broadcast information to the port of the host;
the host saves the second broadcast information;
the point-to-point communication between the master and the slave device comprises:
when the host sends a data instruction to the slave equipment, the second broadcast information is added in front of the message;
and when the slave equipment in the local area network receives the message, comparing the second broadcast information with the parameter information of the slave equipment, if the second broadcast information is the same as the parameter information of the slave equipment, replying the master machine by the slave equipment according to the data instruction, otherwise, if the second broadcast information is not the same as the parameter information of the slave equipment, not replying the master machine by the slave equipment.
2. The method as claimed in claim 1, wherein the first broadcast message and the second broadcast message are both user datagram protocols.
3. The method as claimed in claim 1, wherein the first broadcast message includes parameter information of the slave device.
4. The method as claimed in claim 1, wherein the second broadcast message is a parameter message of the slave device supporting the protocol of the first broadcast message.
5. The method as claimed in any one of claims 1 to 3, wherein the parameter information of the slave device includes MAC address information and device model information.
6. LAN owner is from machine communication protocol implementation device, its characterized in that includes:
a host; the host includes:
the first sending unit is used for sending first broadcast information to the ports of each slave device after the host accesses the local area network;
a first storage unit for storing first broadcast information; the first broadcast information includes parameter information of the slave device;
when the host sends a data instruction to the slave equipment, adding second broadcast information in front of the message; the second broadcast information is parameter information of the slave device supporting a protocol of the first broadcast information;
the first receiving unit is used for receiving data replied by the slave equipment;
a slave device; the slave device includes:
a second receiving unit configured to receive the first broadcast information;
a second storage unit for storing second broadcast information;
a comparison unit, configured to compare the second broadcast information with parameter information of the slave device in the local area network when receiving the message, where if the second broadcast information is the same as the parameter information of the slave device, the slave device replies to the host according to the data instruction, and otherwise, if the second broadcast information is not the same as the parameter information of the slave device, the slave device does not reply to the host;
and the second sending unit is used for sending second broadcast information to the port of the host after receiving the first broadcast information, and replying the host according to the data instruction after the second broadcast information is compared with the parameter information of the host.
7. The system for realizing the communication protocol between the master and the slave of the local area network is characterized by comprising the following components: comprising at least one processor and a memory:
the memory to store one or more program instructions;
the processor is configured to execute one or more program instructions to perform the method according to at least one of claims 1 to 5.
CN202211295505.6A 2022-10-21 2022-10-21 Method, device and system for realizing local area network master-slave computer communication protocol Pending CN115643268A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211295505.6A CN115643268A (en) 2022-10-21 2022-10-21 Method, device and system for realizing local area network master-slave computer communication protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211295505.6A CN115643268A (en) 2022-10-21 2022-10-21 Method, device and system for realizing local area network master-slave computer communication protocol

Publications (1)

Publication Number Publication Date
CN115643268A true CN115643268A (en) 2023-01-24

Family

ID=84944265

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211295505.6A Pending CN115643268A (en) 2022-10-21 2022-10-21 Method, device and system for realizing local area network master-slave computer communication protocol

Country Status (1)

Country Link
CN (1) CN115643268A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117499162A (en) * 2024-01-02 2024-02-02 深圳市玩视科技股份有限公司 Central control system detection method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117499162A (en) * 2024-01-02 2024-02-02 深圳市玩视科技股份有限公司 Central control system detection method, device, equipment and storage medium
CN117499162B (en) * 2024-01-02 2024-04-02 深圳市玩视科技股份有限公司 Central control system detection method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US8972547B2 (en) Method and apparatus for dynamically configuring virtual internet protocol addresses
US6810420B1 (en) Allocation of IP address by proxy to device in a local area network
CN108900351B (en) Intranet equipment type identification method and device
US8938516B1 (en) Switch provided failover
CN112003965B (en) Method for detecting IP conflict of equipment in local area network based on ARP protocol
CN110012118B (en) Method and controller for providing Network Address Translation (NAT) service
CN113315814B (en) IPv6network boundary equipment rapid discovery method and system
CN115643268A (en) Method, device and system for realizing local area network master-slave computer communication protocol
US8358648B1 (en) Allocating socket ranges to increase address space
US11683275B2 (en) Device and method for interconnecting two subnetworks
CN114189492A (en) Network card pressure testing method and system based on network address translation technology
CN103747115A (en) Method of discovering IP (Internet Protocol) address of virtual machine based on virtual network interface card
CN106878485B (en) Message processing method and device
EP3068112B1 (en) System and method for mac address acquisition
EP2257000B1 (en) Copy routing tables
CN101656722A (en) Method for generating dynamic host configuration protocol (DHCP) snooping binding information, and device thereof
KR100582181B1 (en) Communication system capable of using multiple internet protocol address and method thereof
CN111629077B (en) Method, device and storage medium for processing address conflict
EP3200433A1 (en) Ipv6 address management method, device and terminal
CN112073494A (en) Method, device and storage medium for establishing connection
CN113067818B (en) Probe distribution method and device based on network asset checking
CN111586153B (en) Communication method and device for cloud platform
CN114143244B (en) Message processing method and device, storage medium and gateway equipment
CN111935333B (en) NAT type determination method, device, system and storage medium
CN113132502B (en) Network host positioning method, device and 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