CN102082674B - Simulation method and simulation system for data channel - Google Patents

Simulation method and simulation system for data channel Download PDF

Info

Publication number
CN102082674B
CN102082674B CN 200910238693 CN200910238693A CN102082674B CN 102082674 B CN102082674 B CN 102082674B CN 200910238693 CN200910238693 CN 200910238693 CN 200910238693 A CN200910238693 A CN 200910238693A CN 102082674 B CN102082674 B CN 102082674B
Authority
CN
China
Prior art keywords
communication
node
data
nodes
agent
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.)
Expired - Fee Related
Application number
CN 200910238693
Other languages
Chinese (zh)
Other versions
CN102082674A (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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN 200910238693 priority Critical patent/CN102082674B/en
Publication of CN102082674A publication Critical patent/CN102082674A/en
Application granted granted Critical
Publication of CN102082674B publication Critical patent/CN102082674B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a simulation method and simulation system for a data channel. The method comprises the following steps: establishing a communication agent node and a plurality of communication nodes used for simulation equipment or an equipment function; carrying out data transmission on any two communication nodes in the plurality of communication nodes through the communication agent node, wherein for each communication node, a communication link obtained by programming exists between the communication node and the communication agent node. According to the invention, the communication link obtained by programming and the node are utilized to realize the data transmission stimulation, thus avoiding that data transmission stimulation depends on actual single boards and specific hardware among the actual single boards simply, effectively shortening the development period of equipment, improving the development speed of the equipment, and improving the development efficiency of the equipment.

Description

Simulation method and system of data channel
Technical Field
The present invention relates to the field of communications, and in particular, to a method and a system for simulating a data channel.
Background
At present, physical channels such as a High-level data Link Control (HDLC), an I2C (Inter-Integrated Circuit), a Universal Asynchronous Receiver/Transmitter (UART), and the like are mainly used for data communication between communication devices (such as single boards).
With the rapid development of communication technology, the requirements for the development cycle of communication equipment are shorter and shorter, and the requirements for development speed and development efficiency are higher and higher, but data channels such as HDLC, I2C, UART and the like are all formed by physical devices, so that the development speed of the equipment is reduced, the development cycle of the communication equipment is prolonged, and the development efficiency of the equipment is reduced, which is not in accordance with the rapid development and fast-paced requirements of the communication technology.
However, no effective solution has been proposed at present for the problems of long development period, slow development speed and low development efficiency of the communication device in the prior art.
Disclosure of Invention
Aiming at the problems of longer development period, slow development speed and lower development efficiency of communication equipment in the prior art, the invention provides a simulation method of a data channel, which can shorten the development period.
Aiming at the problems of longer development period, slow development speed and lower development efficiency of communication equipment in the prior art, the invention also provides a simulation system of the data channel, which can shorten the development period.
The technical scheme of the invention is realized as follows:
a method of emulation of a data channel, comprising:
establishing a communication agent node and a plurality of communication nodes for simulating equipment or equipment functions;
and any two communication nodes in the plurality of communication nodes transmit data through the communication agent node, wherein for each communication node, a communication link obtained by programming exists between the communication node and the communication agent node.
Further, the method further comprises:
establishing sockets for the communication agent node and the plurality of communication nodes respectively;
the existence of the programmed communication link between the communication node and the communication agent node means that: and a transmission control protocol link based on sockets exists between the communication node and the communication agent node, wherein the sockets on the communication agent node correspond to the sockets on the communication node one to one.
Wherein the attribute information of the communication node includes: address information and/or group number.
When transmitting unicast data, the operation that any two communication nodes in the plurality of communication nodes transmit data through the communication agent node includes:
for any communication node in the plurality of communication nodes, the communication node sends destination address information and a unicast data packet to the communication agent node;
and the communication proxy node sends the unicast data packet to a communication node corresponding to the destination address information.
When multicast data is transmitted, the operation that any two communication nodes in the plurality of communication nodes transmit data through the communication agent node includes:
for any communication node in the plurality of communication nodes, the communication node sends a multicast address and a multicast data packet to the communication agent node;
the communication agent node sends the multicast data packet to all communication nodes in the multicast address;
or,
for any communication node in the plurality of communication nodes, the communication node sends a multicast data packet to the communication agent node, wherein the multicast data packet carries a multicast data identifier;
and the communication agent node sends the multicast data packet to all communication nodes corresponding to the multicast data identifier.
Preferably, the operation of any two communication nodes in the plurality of communication nodes to transmit data through the communication proxy node comprises:
for any of the plurality of communication nodes, the communication proxy node forwards the received data packet into a socket of the communication node.
Preferably, for any communication node in the plurality of communication nodes, the communication node periodically detects a socket thereon, searches whether a data packet from other communication nodes exists in the socket, and reads the searched data packet.
If the attribute information of the communication node comprises the callback function, the communication node monitors the socket on the communication node in real time, checks whether the socket contains data packets from other communication nodes, and reads the searched data packets.
Further, the method further comprises:
for any of the plurality of communication nodes, the communication node sending registration information to the communication proxy node for registering on the communication proxy node, wherein the registration information includes: address information and group number.
Further, the method further comprises:
the communication agent node establishes a node data queue for the communication node registered on the communication agent node, and places the data packet from the communication node in the node data queue corresponding to the communication node.
Further, the method further comprises:
for a communication node that is not registered with the communication proxy node, the communication proxy node placing a data packet from the communication node in an unregistered node data queue;
and if the unregistered communication node is successfully registered on the communication agent node, the communication agent node transmits the data packet to be sent to the communication node.
A simulation system for a data channel, comprising
The establishing module is used for establishing a communication agent node and a plurality of communication nodes;
and the simulation module is used for simulating data transmission of any two communication nodes in the plurality of communication nodes through the communication agent node, wherein for each communication node, a communication link obtained by programming exists between the communication node and the communication agent node.
The simulation module is further configured to establish sockets for the communication agent node and the plurality of communication nodes, respectively, and to establish a transmission control protocol link based on sockets for simulation between the communication node and the communication agent node, where the sockets on the communication agent node correspond to the sockets on the communication node one to one.
By means of the technical scheme, the simulation of data transmission is realized through the communication link and the node obtained by programming, the data transmission simulation is prevented from being purely dependent on an actual single board and specific hardware therebetween, the period of equipment development can be effectively shortened, the speed of the equipment development is increased, and the efficiency of the equipment development is improved.
Drawings
FIG. 1 is a flow diagram of a method of simulating a data channel according to an embodiment of the invention;
FIG. 2 is a schematic diagram of the relationship of a communication node and a communication agent node according to an embodiment of the present invention;
FIG. 3 is a flow chart of steps of a communication node initialization process according to an embodiment of the present invention;
fig. 4 is a flow chart of a process for a communication node to receive data in a polling mode according to an embodiment of the invention;
fig. 5 is a schematic structural diagram of a node data queue of a communication node held in a communication agent node according to an embodiment of the present invention;
fig. 6 is a schematic diagram of an unregistered correspondent node data queue maintained in a correspondent node, according to an embodiment of the present invention;
FIG. 7 is a flow diagram of a main loop process for a communication proxy node according to an embodiment of the present invention;
FIGS. 8 a-8 b are a flow of a TCP connection handling read event in a communication proxy node according to an embodiment of the present invention;
FIG. 9 is a process flow diagram of a communication proxy node write event according to an embodiment of the invention;
FIG. 10 is a block diagram of components of a simulation system for a data channel in accordance with an embodiment of the present invention.
Detailed Description
The following describes embodiments of the present invention in detail with reference to the accompanying drawings.
Fig. 1 is a flowchart of steps of a simulation method of a data channel according to an embodiment of the present invention, which is used for simulating data transmission between or within devices, and as shown in fig. 1, the method includes the following processes:
step S101, establishing a communication agent node and a plurality of communication nodes for simulating equipment or equipment functions, wherein the attribute information of the communication nodes comprises: address information and/or group number, each communication node corresponds to a functional module on a communication device (e.g., a board) to implement the functions of the functional module, so that a plurality of communication nodes can be created as needed to implement a plurality of functions on the communication device.
Step S102, any two communication nodes in the plurality of communication nodes transmit data through the communication agent node, wherein for each communication node, a communication link exists between the communication node and the communication agent node, and specifically, sockets can be respectively established for the communication agent node and the plurality of communication nodes, so that a Transmission Control Protocol (TCP) link based on the socket exists between the communication node and the communication agent node, and the communication node and the communication agent node transmit data through the TCP link, wherein the sockets on the communication agent node correspond to the sockets on the communication node one to one; for example, there are three communication nodes, i.e., communication node 1, communication node 2 and communication node, at this time, a socket may be created on each communication node, and three sockets may be created on the proxy communication node, assuming that socket 1, socket 2 and socket 3 are provided, and a TCP link between communication node 1 and the communication proxy node is established through the sockets on socket 1 and communication node 1, a TCP link between communication node 2 and the communication proxy node is established through the sockets on socket 2 and communication node 2, and a TCP link between communication node 3 and the communication proxy node is established through the sockets on socket 3 and communication node 3, so that inter-device or intra-device data transmission can be realized in a simulation environment based on a socket mechanism. Preferably, a plurality of established communication nodes may be grouped, for example, referring to a relationship diagram of the communication nodes and the communication agent node shown in fig. 2, each communication node can only perform data interaction with the communication nodes in its own group, so that when the communication nodes are established, one communication node can be uniquely determined according to the address information and the group number.
When unicast data are transmitted, the communication node sends destination address information and a unicast data packet to the communication proxy node, and the communication proxy node sends the unicast data packet to the communication node corresponding to the destination address information; when transmitting multicast data, the communication node sends a multicast address and a multicast data packet to the communication agent node; the communication agent node sends the multicast data packet to all communication nodes in the multicast address; or when transmitting multicast data, the communication node sends a multicast data packet to the communication agent node, wherein the multicast data packet carries a multicast data identifier; and the communication agent node sends the multicast data packet to all communication nodes corresponding to the multicast data identifier.
Referring to a relationship diagram of a communication node and a communication proxy node shown in fig. 2, in a specific implementation process, firstly, operating the communication proxy node 202, starting to operate, establishing an empty communication node 101 queue and an unregistered communication node 101 data queue, establishing a monitoring socket, then constructing a read set and a write event set of TCP connection (including a TCP connection event of the monitoring socket), monitoring occurrence of read and write events on the set, and performing corresponding processing; then, the communication node 101 is initialized, and the communication node 101 actively establishes a TCP connection with the communication proxy node 202, for example, tries the connection 3 times, and if the connection is unsuccessful, the initialization fails. If the TCP connection is successfully established, sending address information and/or a communication group number of the communication node 101 to the communication proxy node 202 for registration, and the communication node 101 waits for a registration response, optionally, if a callback function is specified during initialization operation, the communication node 101 creates a daemon task to receive data; then, the communication node 101 receives data, if a callback function is specified during initialization operation, the communication node receives data in an interrupt mode, and if no callback function is specified during initialization operation, the communication node receives data in a polling mode; in the communication process, the communication node 101 sends data to the communication proxy node 202, if the data is unicast data, the data is sent in a unicast mode, and if the data is multicast data, the data is sent in a multicast mode; the communication agent node 202 forwards the data from the communication node 101, specifically, if the communication agent node 202 receives the unicast data from the communication node 101, it searches the queue of the communication node 101 to find the destination communication node, and forwards the data to the destination communication node, if the communication agent node 202 receives the multicast data from the communication node 101, it forwards the data to all communication nodes 1 belonging to the same group as the communication node 101; if the communication agent node 202 does not find the destination communication node, the data is cached in the unregistered communication node data queue until the destination communication node is successfully registered on the communication agent node 202, and then the data is forwarded to the destination communication node.
The processing of the invention does not depend on specific hardware of communication between actual single boards, and can be realized as long as an operating system in the equipment supports a socket mechanism. Through the processing, the link layer function can be simulated, namely the transceiving of the two-layer data packet is realized, the original communication API interface is not changed, the program change is small, the simulation of the communication functions of various specific hardware such as HDLC, UART, I2C and the like can be realized, the transceiving function of data can be realized through a physical channel between simulation single boards, and the point-to-point communication and the multicast communication are supported. The method does not simulate the physical characteristics of a physical channel and only realizes the data transceiving characteristics.
In addition, in the above processing, the communication node module and the communication agent module are mainly involved, where the communication node module may be configured to complete channel initialization, data receiving, and data sending functions, and the communication agent module may be configured to manage the communication node, forward the communication node data, and control the data traffic of the communication node.
Fig. 3 is a flowchart of steps of an initialization process of a communication node according to an embodiment of the present invention, where the process shown in fig. 3 is executed for each communication node, and the process mainly includes the following steps:
step S301, allocating address information to the communication nodes, if a plurality of communication nodes need to be grouped, allocating a group number to each communication node, optionally, also assigning a callback function to the communication nodes, and creating a Socket on the communication nodes.
Step S302, the communication node actively initiates the operation of establishing TCP connection to the communication agent node.
Step S303, if a TCP connection is established between the communication node and the communication agent node, step S304 is executed; otherwise, step S302 is performed.
In step S304, the communication node sends registration information to the communication agent node, where the registration information may include one of: address information of the communication node, and a communication group number.
In step S305, the correspondent node receives a registration reply message from the correspondent node.
Step S306, determining whether the communication node designates a callback function, if so, executing step S307, otherwise, executing step S308.
Step S307, a daemon task is created for the communication node, data is received in an interrupt mode, that is, the communication node monitors a Socket on the TCP link in real time, searches whether a data packet from another communication node exists in the Socket, reads the searched data packet, and processes the read data packet by using a callback function.
Step S308, the communication node receives data in a polling mode, periodically detects a Socket on the TCP link, checks whether a data packet from other communication nodes exists in the Socket, and reads the searched data packet.
In step S302 and step S303, a threshold of the number of times that the communication node initiates the operation of establishing the TCP connection may be set, for example, 3 times, if the communication node initiates the operation of establishing the TCP connection to the communication agent node for 3 times, the initialization process fails, and the node may initiate the operation of establishing the TCP connection to the communication agent node after a period of time.
Fig. 4 is a flowchart of a process of a communication node receiving data in a polling mode according to an embodiment of the present invention, as shown in fig. 4, including the following processes:
step S401, judging whether a callback function is appointed when the communication node is initialized, if the callback function is appointed, indicating that the node does not support the polling mode to receive data, the data reception is failed, and if the callback function is not appointed, executing step S402.
Step S402, the communication node waits for a read event to occur on its own TCP connection, that is, the communication node periodically detects a Socket on the TCP link, checks whether a packet from another communication node exists in the Socket, and reads the found packet.
Step S403, the communication node determines whether the data received last time has been received according to the message header in the data packet, if so, step S405 is executed, otherwise, step S404 is executed.
In step S404, the communication node continues to receive the data that was not completely received last time.
In step S405, the communication node receives a new packet stored in the Socket.
Fig. 5 is a schematic structural diagram of a node data queue of a communication node stored in a communication proxy node according to an embodiment of the present invention, and as shown in fig. 5, when the communication proxy node starts up, a communication node queue 501 is empty, and when the communication node establishes a TCP connection with the communication proxy node and successfully registers on the communication proxy node, the communication proxy node allocates a node data queue 506 for the communication node in the communication node queue 501. When the communication node has a data packet 515 to be transmitted, the communication agent node first inserts the data packet 515 into the data packet queue 506 to be transmitted, and when the data packet queue 506 to be transmitted reaches a certain length, the communication agent node blocks the communication node and inserts the data packet from the communication node into the blocked communication node queue 504. In addition, the communication node queue 501 also holds the following attribute information of the communication node: registration information 503 for uniquely identifying the communication node; socket 502, used to identify established TCP connections; a currently transmitted data packet 508 and a transmitted data length 509 of the data packet; a currently received data packet 510 and a received data length 511 of the data packet; blocked correspondent node queue 504 (e.g., correspondent node 1 and correspondent node 2) and queue length 505; a communication node blocked state 512 for identifying whether the communication node is blocked; a next blocked correspondent node 514 for pointing to a next blocked correspondent node; the next communication node 513 is configured to point to the next communication node in the queue, and the communication node queue 501 also stores the attribute information of the communication node 513, which is similar to the above attribute information and is not described herein again.
Fig. 6 is a schematic diagram of an unregistered correspondent node data queue maintained in a correspondent node, according to an embodiment of the present invention. When the communication agent node 202 starts up, the queue of the unregistered communication node data queue 601 is empty, and after the communication agent node 202 receives the data packet 602 and finds that the communication node 603 at the receiving end is not registered yet, the communication node 603 is inserted into the unregistered communication node data queue 601, and the following attribute information is stored in the unregistered communication node data queue 601: a data packet 602; a communication node 603 at the receiving end; the unregistered data node also stores a next unregistered communication node data node 604 for pointing to the next unregistered communication node data node, and the unregistered communication node data queue 601 also stores attribute information of the communication node 604, which is similar to the above attribute information and is not described here again. In a specific implementation process, the communication proxy node does not directly discard the data packet 602, but waits until the communication node 603 of the receiving end registers successfully on the communication proxy node 202, and then forwards the data packet 602 to the communication node 603 of the receiving end.
For a communication node successfully registered with a communication agent node, the communication agent node may establish a node data queue for the communication node, and place a data packet from the communication node in the node data queue corresponding to the communication node, for example, if ten communication nodes successfully registered with the communication agent node, the communication agent node may establish ten node data queues, each node data queue stores a data packet from the same communication node, the main loop processing procedure of the communication agent node is described below by taking the node data queue of one communication node as an example in conjunction with fig. 5, fig. 6, and fig. 7, fig. 7 is a flowchart of the main loop processing procedure of the communication agent node according to the embodiment of the present invention, and as shown in fig. 7, the main loop processing procedure of the communication agent node mainly includes the following steps:
step S701, the communication proxy node creates a monitoring Socket.
Step S702, the communication agent node traverses the communication node queue 501 (i.e. the above-mentioned node data queue) to construct a TCP connection set of read events and write events, and monitors a socket to add a read event set, for a blocked communication node, a read event set cannot be added, and only a write event set can be added, and for an unblocked communication node, a read event set and a write event set are added, where a write event refers to: the communication node sends a data packet to the communication agent node, and the communication agent node sends the data packet to the communication node, wherein the read event refers to: the communication node receives the data packet forwarded by the communication proxy node, and the communication proxy node receives the data packet from the communication node.
Step S703, the communication agent node monitors the event on the read event set and the write event set, respectively, and waits for the event to occur.
Step S704, after the event occurs, if it is a read event, step S705 is executed, otherwise step S706 is executed.
In step S705, after the communication agent node processes the read event, step S702 is executed.
In step S706, after the communication agent node processes the write event, step S702 is executed.
The following describes a process of processing a read event by a TCP connection in a communication proxy node with reference to fig. 5, fig. 6, and fig. 8, where fig. 8 is a flow of processing a read event by a TCP connection in a communication proxy node according to an embodiment of the present invention, and as shown in fig. 8, the method includes the following steps:
step S801, the communication agent node determines whether a read event occurs on the monitoring Socket, if so, step S802 is executed, otherwise, step S809 is executed.
In step S802, the communication proxy node receives the TCP connection request of the communication node, and creates a new TCP connection.
Step S803, the communication agent node receives the registration information of the communication node
Step S804, the communication agent node judges whether the communication node is registered, if the communication node is registered, the communication node is indicated to be repeatedly registered, and step S805 is executed; otherwise, step S806 is performed.
In step S805, the communication proxy node closes the original TCP connection and releases the corresponding communication node in the communication node queue 501.
Step S806, the communication proxy node sends a registration success response message to the corresponding communication node.
In step S807, the communication proxy node allocates a new node data queue to the communication node that establishes the connection, and stores relevant data such as registration information of the communication node in the new node data queue, and inserts the data into the communication node queue 501.
Step S808, the communication agent node traverses the unregistered communication node data queue 601, and if there is a data packet 602 of the communication node, inserts the data packet queue 506 to be sent, and waits for sending later.
Step S809, the communication agent node traverses the communication node queue 501, and determines whether the traversal is completed, if the traversal is not completed, step S810 is executed, and if the traversal is completed, the read event processing is completed.
In step S810, the communication agent node determines a communication node where the read event occurs.
Step S811, the communication agent node judges whether the last data reception is finished, if yes, step S812 is executed; otherwise, step S813 is performed.
Step S812, the communication agent node receives the new message data
In step S813, the communication agent node continues to receive the last message data, and performs step S814.
Step S814, the communication agent node judges that all data packets from the communication node are received, if the judgment result is yes, the read event processing is finished; otherwise, step S815 is performed.
Step S815, the communication proxy node determines whether the received data is a unicast message, and if the received data is unicast data, executes step S816; otherwise, step S819 is executed.
Step S816, the communication proxy node judges whether the communication node of the receiving end is registered, if so, step S817 is executed; otherwise, step S818 is executed.
In step S817, the communication proxy node inserts the data packet 515 into the to-be-sent data packet queue 506 of the receiving-end communication node 101, and blocks the communication node at the sending end after the data packet queue 506 reaches a certain length, and then executes step S809.
In step S818, the correspondent node inserts the packet 602 into the unregistered correspondent node queue 601, and performs step S809.
In step S819, the communication agent node traverses the communication node queue 501, adds a reference count to the broadcast packet for each communication node 101 in the same group, inserts the reference count into the to-be-sent packet queue 506 of the communication node, and executes step S809.
Fig. 9 is a flowchart of a processing procedure of a communication agent node writing event according to an embodiment of the present invention, as shown in fig. 9, main steps are described as follows:
step S901, the communication agent node traverses the communication node queue, judges whether the traversal is finished, if the traversal is finished, the write event processing is finished, and the process is finished; otherwise, step S902 is executed.
In step S902, the communication agent node determines the communication node that sent the write event.
Step S903, the communication agent node judges whether the last message data is sent, if the last message data is sent, step S905 is executed; otherwise, step S904 is executed.
In step S904, the communication proxy node continues to send the remaining data of the last message and performs step S906.
In step S905, the communication agent node transmits data of the new message.
Step S906, the communication agent node determines whether the message data is sent completely, if so, step S901 is executed, otherwise, step S907 is executed.
In step S907, the communication proxy node decrements the reference of the packet, and if the packet is not used by any communication node, releases the packet, and goes to step S901.
Through the processing, the simulation of data transmission can be realized by means of the communication link and the node obtained by programming, the data transmission simulation is prevented from being purely dependent on an actual single board and specific hardware therebetween, and the purpose of link layer function simulation can be achieved under the condition of not changing an original communication API (application program interface), so that the period of equipment development is effectively shortened, the speed of equipment development is increased, and the efficiency of equipment development is improved.
Fig. 10 is a configuration diagram of a simulation system of a data channel according to an embodiment of the present invention, and as shown in fig. 10, the simulation system of the data channel includes:
the system comprises an establishing module 1, a communication proxy node and a plurality of communication nodes, wherein the establishing module is used for establishing the communication proxy node and the communication nodes for simulating equipment or equipment functions;
the simulation module 2 is used for simulating data transmission of any two communication nodes in the plurality of communication nodes through the communication agent node, wherein for each communication node, a communication link obtained by programming exists between the communication node and the communication agent node; the simulation module 2 is further configured to establish sockets for the communication agent node and the plurality of communication nodes, respectively, and establish a transmission control protocol link based on the sockets for simulation between the communication node and the communication agent node, where the sockets on the communication agent node correspond to the sockets on the communication node one to one.
The system shown in fig. 10 may be implemented as a simulation of the communication system shown in fig. 2. The communication node and the communication agent node shown in fig. 2 and the communication link therebetween can be obtained by simulation programming, and from a network level, the communication agent node 202 can be regarded as a network set formed by n virtual local area networks, wherein the communication agent 102 can also be a centralized controller for managing all virtual local area networks and all registered communication nodes 101. Each communication node can only be connected to one virtual local area network, and a plurality of communication nodes belonging to the same virtual local area network can communicate with each other, and when the communication nodes send multicast data, the communication nodes belonging to the same virtual local area network can receive the data.
In order to realize the simulation by the system shown in fig. 10, it is necessary that the communication node 101 is capable of performing the functions of initialization operation of the device, reading data, writing data, and turning off the device. Specifically, in the initialization process of the device, the communication node 101 is used to specify an address of the communication node, a communication group (equivalent to a local area network) where the node is located, and an IP address when the communication proxy node operates; the method is used for the communication node to actively establish the TCP connection with the communication proxy node 202, and after success, the communication node sends its attribute information (such as the address of the communication node and the communication group number of the communication node) to the communication proxy node 202 to register on the communication proxy node, and generally, each communication node can only register once; the communication node 101 is also configured to provide two read and write data modes: the communication node actively reads the data when the polling mode is applied to read and write the data, and returns the actually read data each time instead of the specified data length; when the application interrupt mode reads data, a callback function written by the application needs to be transferred when the device is initialized, and after receiving a complete data packet, the communication node 101 calls the callback function to transfer the data packet to the application for processing, generally speaking, the communication node can only use one of the polling mode and the interrupt mode to read and write the data; the communication nodes 101 may transmit data in a point-to-point manner or in a multicast manner, and generally, only the communication nodes in the same communication group can receive multicast data, and the communication agent node 202 processes the multicast data according to the registration information of the communication nodes.
In addition, the communication agent node 202 is also required to be able to manage communication nodes, forward data, and control communication node traffic. Specifically, the communication agent node 202 establishes a communication node queue, and stores registration information of all communication nodes, TCP connection information, and data of the communication nodes. The communication agent node also needs to establish a node data queue for each registered communication node for caching data from the communication node, and the communication agent node 202 also establishes a data queue for an unregistered node, so that when the unregistered communication node receives data forwarded by the communication agent node, the communication agent node 202 can cache the data in the data queue for the unregistered node, and after the communication node is successfully registered, the communication agent node 202 can forward the data cached in the data queue for the unregistered node to the communication node. For example, if the number of communication nodes registered in the communication proxy node 202 is n, the communication proxy node 202 has (n +1) data queues in common. When the communication agent node 202 detects that the length of the data queue in the node data queue of the communication node is greater than or equal to the length threshold, the node data queue of the communication node is blocked, and when the length of the data queue in the queue is less than the length threshold, the node data queue of the communication node is blocked, so as to implement the flow control function. After receiving the multicast data of the communication node, the communication proxy node 202 sends the multicast data to all other communication nodes belonging to the same communication group as the communication node, that is, the communication nodes in the same communication group as the communication node all reserve a reference to the data, so as to implement the multicast function. The communication agent node 202 listens to TCP connections of all registered communication nodes, checks read events and write events occurring at the communication nodes, and when a communication node is blocked, the communication agent node only detects the write event of the communication node, but not the read event of the communication node.
Based on the above-mentioned functions of the communication agent node and the communication node, the simulation system of the data channel according to this embodiment can implement the simulation processing given by each flow in the method embodiment, and the specific process has been described before, and is not repeated here.
Fig. 10 is a system corresponding to the foregoing method, and the working process and working principle of the system have been described in detail in the method section, and are not repeated herein, and reference may be made to the description of the corresponding section in the method.
By means of the technical scheme, the simulation of data transmission can be realized by means of the communication link and the node obtained by programming, the data transmission simulation is prevented from being purely dependent on an actual single board and specific hardware therebetween, and the purpose of link layer function simulation can be achieved under the condition that an original communication API (application program interface) is not changed, so that the period of equipment development is effectively shortened, the speed of equipment development is increased, and the efficiency of equipment development is improved.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (12)

1. A simulation method of a data channel is used for simulating data transmission of equipment, and is characterized by comprising the following steps:
establishing a communication agent node and a plurality of communication nodes for simulating equipment or equipment functions;
grouping the communication nodes and identifying the communication nodes by using the attribute information of the communication nodes, wherein the attribute information of the communication nodes comprises: address information and group number;
and any two communication nodes in the plurality of communication nodes in the same group transmit data through the communication proxy node, wherein for each communication node, a communication link exists between the communication node and the communication proxy node, and in the transmission process of the data, the communication node specifies a destination address and a destination group number to which the data is transmitted, and the communication proxy node transmits the transmitted data to the corresponding communication node according to the destination address and the destination group number.
2. The method of claim 1, further comprising:
establishing sockets for the communication agent node and the plurality of communication nodes respectively;
the existence of the communication link between the communication node and the communication agent node means that:
and a transmission control protocol link based on sockets exists between the communication node and the communication agent node, wherein the sockets on the communication agent node correspond to the sockets on the communication node one to one.
3. The method of claim 1, wherein the operation of any two communication nodes in the plurality of communication nodes to transmit data via the communication proxy node when transmitting unicast data comprises:
for any communication node in the plurality of communication nodes, the communication node sends destination address information and a unicast data packet to the communication agent node;
and the communication proxy node sends the unicast data packet to a communication node corresponding to the destination address information.
4. The method of claim 1, wherein the operation of any two communication nodes in the plurality of communication nodes to transmit data through the communication agent node when transmitting multicast data comprises:
for any communication node in the plurality of communication nodes, the communication node sends a multicast address and a multicast data packet to the communication agent node;
the communication agent node sends the multicast data packet to all communication nodes in the multicast address;
or,
for any communication node in the plurality of communication nodes, the communication node sends a multicast data packet to the communication agent node, wherein the multicast data packet carries a multicast data identifier;
and the communication agent node sends the multicast data packet to all communication nodes corresponding to the multicast data identifier.
5. The method of claim 2, wherein the operation of any two of the plurality of communication nodes to transmit data through the communication proxy node comprises:
for any of the plurality of communication nodes, the communication proxy node forwards the received data packet into a socket of the communication node.
6. The method according to claim 5, wherein for any communication node in the plurality of communication nodes, the communication node periodically detects a socket thereon, searches whether a packet from other communication nodes exists in the socket, and reads the searched packet.
7. The method according to claim 5, wherein if the attribute information of the communication node includes a callback function, the communication node monitors a socket thereon in real time, checks whether a packet from another communication node exists in the socket, and reads the found packet.
8. The method of any one of claims 1 to 7, further comprising:
for any of the plurality of communication nodes, the communication node sending registration information to the communication proxy node for registering on the communication proxy node, wherein the registration information includes: address information and group number.
9. The method of claim 8, further comprising:
the communication agent node establishes a node data queue for the communication node registered on the communication agent node, and places a data packet to be sent to the communication node in the node data queue corresponding to the communication node.
10. The method of any one of claims 1 to 7, further comprising:
for a communication node which is not registered on the communication agent node, placing a data packet to be sent to the communication node by the communication agent node in a data queue of the unregistered node;
and if the unregistered communication node is successfully registered on the communication agent node, the communication agent node transmits the data packet to be sent to the communication node.
11. A simulation system for a data channel, comprising
The system comprises an establishing module, a simulation module and a control module, wherein the establishing module is used for establishing a communication agent node and a plurality of communication nodes for simulating the functions of equipment; grouping the communication nodes and identifying the communication nodes by using the attribute information of the communication nodes, wherein the attribute information of the communication nodes comprises: address information and group number;
and the simulation module is used for simulating data transmission performed by any two communication nodes in the plurality of communication nodes in the same group through the communication agent node, wherein for each communication node, a communication link obtained by programming exists between the communication node and the communication agent node, in the data transmission process, the communication node specifies a destination address and a destination group number for data transmission, and the communication agent node transmits the transmitted data to the corresponding communication node according to the destination address and the destination group number.
12. The system according to claim 11, wherein the emulation module is further configured to establish sockets for the communication agent node and the plurality of communication nodes, respectively, and establish a socket-based transmission control protocol link for emulation between the communication node and the communication agent node, wherein the sockets on the communication agent node correspond to the sockets on the communication node in a one-to-one manner.
CN 200910238693 2009-12-01 2009-12-01 Simulation method and simulation system for data channel Expired - Fee Related CN102082674B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200910238693 CN102082674B (en) 2009-12-01 2009-12-01 Simulation method and simulation system for data channel

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200910238693 CN102082674B (en) 2009-12-01 2009-12-01 Simulation method and simulation system for data channel

Publications (2)

Publication Number Publication Date
CN102082674A CN102082674A (en) 2011-06-01
CN102082674B true CN102082674B (en) 2013-11-06

Family

ID=44088432

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200910238693 Expired - Fee Related CN102082674B (en) 2009-12-01 2009-12-01 Simulation method and simulation system for data channel

Country Status (1)

Country Link
CN (1) CN102082674B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102427406B (en) 2011-11-14 2014-03-12 华为技术有限公司 Method and equipment for processing media data packets and conference system
CN103533039B (en) * 2013-09-27 2017-04-19 深圳市瑞彩电子技术有限公司 P2P (Peer-to-Peer) data transmission method, forwarding proxy server and system
CN111479293B (en) * 2020-04-16 2023-07-25 展讯通信(上海)有限公司 Data processing method and device
CN117217067A (en) * 2022-05-31 2023-12-12 北京有竹居网络技术有限公司 Simulation device, simulation system, simulation method thereof, and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101031124A (en) * 2006-03-03 2007-09-05 中兴通讯股份有限公司 Platform for testing applied large-traffic volume of packet data service father in CDMA telecommunication system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101031124A (en) * 2006-03-03 2007-09-05 中兴通讯股份有限公司 Platform for testing applied large-traffic volume of packet data service father in CDMA telecommunication system

Also Published As

Publication number Publication date
CN102082674A (en) 2011-06-01

Similar Documents

Publication Publication Date Title
JP4005996B2 (en) Broadcast data processing method in mobile ad hoc network
CN102082674B (en) Simulation method and simulation system for data channel
US7921458B2 (en) Packet routing method, computer system, and computer product
CN110312283B (en) Information processing method and device
JP2017526296A (en) Data transmission method and base station
EP1250777A1 (en) Broadcast as a triggering mechanism for route discovery
EP3541116A1 (en) Data migration method and device
JP2019195154A (en) Multi-gateway communication method and radio gateway system thereof
JP5801887B2 (en) System and method for communicating between nodes of a wireless network
CN104022956A (en) Method and device for data message processing in location/ID separation protocol network
KR20180090528A (en) Method for updating firmware of Low Power Wide Area Module
CN111274173A (en) ZYNQ-based multi-node SRIO communication design method and device
CN114827908A (en) VN group communication method, device, equipment and storage medium
EP2432168A1 (en) Inter-board communication apparatus, method for transmitting and receiving message of inter-board communication
US9602386B2 (en) Node apparatus, record medium for storing control program, wireless communication system, and method for data communication
CN101572664B (en) GRE tunnel collocation method and router thereof
JP2007081569A (en) Radio network information distribution method
CN107483628B (en) DPDK-based one-way proxy method and system
CN115915098A (en) Method for realizing BMCA in 5G and TSN cross-domain PTP
JP2003258859A (en) Communication system, communicating method, transferring device and network managing device
CN101741811A (en) Registration method, system and local mobile anchor point of interface prefix in PMIPv6 (proxy mobile internet protocol version 6)
CN114124275B (en) Time synchronization method, device, equipment and storage medium
JP4487058B2 (en) Wireless communication system and wireless communication method
RU2643492C2 (en) Method of route optimization, router and location administrator object
CN102413512A (en) Communication method and apparatus thereof, and terminal

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20131106

Termination date: 20181201

CF01 Termination of patent right due to non-payment of annual fee