patents.google.com

CN103685028B - The method and device that polymorphic type port is in communication with each other - Google Patents

  • ️Tue Jun 12 2018
The method and device that polymorphic type port is in communication with each other Download PDF

Info

Publication number
CN103685028B
CN103685028B CN201310625518.XA CN201310625518A CN103685028B CN 103685028 B CN103685028 B CN 103685028B CN 201310625518 A CN201310625518 A CN 201310625518A CN 103685028 B CN103685028 B CN 103685028B Authority
CN
China
Prior art keywords
port
message
buffering area
source port
source
Prior art date
2013-11-30
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310625518.XA
Other languages
Chinese (zh)
Other versions
CN103685028A (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.)
XJ Electric Co Ltd
Xuchang XJ Software Technology Co Ltd
Original Assignee
XJ Electric Co Ltd
Xuchang XJ Software 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.)
2013-11-30
Filing date
2013-11-30
Publication date
2018-06-12
2013-11-30 Application filed by XJ Electric Co Ltd, Xuchang XJ Software Technology Co Ltd filed Critical XJ Electric Co Ltd
2013-11-30 Priority to CN201310625518.XA priority Critical patent/CN103685028B/en
2014-03-26 Publication of CN103685028A publication Critical patent/CN103685028A/en
2018-06-12 Application granted granted Critical
2018-06-12 Publication of CN103685028B publication Critical patent/CN103685028B/en
Status Active legal-status Critical Current
2033-11-30 Anticipated expiration legal-status Critical

Links

  • 230000006854 communication Effects 0.000 title claims abstract description 27
  • 238000004891 communication Methods 0.000 title claims abstract description 26
  • 238000000034 method Methods 0.000 title claims abstract description 21
  • 238000012544 monitoring process Methods 0.000 claims description 7
  • 230000003139 buffering effect Effects 0.000 claims 21
  • 230000005540 biological transmission Effects 0.000 claims 8
  • 238000000605 extraction Methods 0.000 claims 2
  • 230000011218 segmentation Effects 0.000 claims 1
  • 239000000872 buffer Substances 0.000 abstract description 63
  • 101100048435 Caenorhabditis elegans unc-18 gene Proteins 0.000 description 26
  • 101150063504 CAN2 gene Proteins 0.000 description 11
  • 239000000284 extract Substances 0.000 description 6
  • 101150008604 CAN1 gene Proteins 0.000 description 2
  • 238000006243 chemical reaction Methods 0.000 description 2
  • 238000010586 diagram Methods 0.000 description 2
  • 238000012986 modification Methods 0.000 description 2
  • 230000004048 modification Effects 0.000 description 2
  • 101000746134 Homo sapiens DNA endonuclease RBBP8 Proteins 0.000 description 1
  • 101000969031 Homo sapiens Nuclear protein 1 Proteins 0.000 description 1
  • 102100021133 Nuclear protein 1 Human genes 0.000 description 1
  • 230000002452 interceptive effect Effects 0.000 description 1
  • 238000012545 processing Methods 0.000 description 1

Landscapes

  • Small-Scale Networks (AREA)

Abstract

本发明涉及多类型端口相互通信的方法及装置,把源端口收到的报文存储到接收缓冲区;将接收到的报文加上源端口号及要发送报文的长度发送到转发模块;转发模块根据接收到的信息查找转发表,判断源端口是否有要转发的不同于源端口类型的目的端口,若是没有,则不转发报文;若是有,则判断目的端口为源端口生成的发送缓冲区剩余空间是否能存下要接收的报文,若是能,则源端口发送报文到该发送缓冲区,若是不能,则等该发送缓冲区满足条件后再转发;目的端口将发送缓冲区中的数据根据其端口类型,转换成相应格式的报文转发出去,直到发送缓冲区为空;本发明解决了多种不同类型端口不能相互转发的问题,实现了不同类型端口的装置相互通信。

The invention relates to a method and a device for communicating with multiple types of ports, storing messages received by a source port in a receiving buffer; adding the received message to the forwarding module with the source port number and the length of the message to be sent; The forwarding module searches the forwarding table according to the received information, and judges whether the source port has a destination port different from the source port type to be forwarded. If not, the message is not forwarded; Whether the remaining space in the buffer can store the message to be received, if yes, the source port will send the message to the send buffer, if not, wait for the send buffer to meet the conditions before forwarding; the destination port will send the buffer According to the port type, the data in the device is converted into a message of the corresponding format and forwarded until the sending buffer is empty; the invention solves the problem that multiple different types of ports cannot be forwarded to each other, and realizes the mutual communication between devices with different types of ports.

Description

多类型端口相互通信的方法及装置Method and device for mutual communication between multiple types of ports

技术领域technical field

本发明属于通信技术领域,涉及一种多类型端口相互通信的方法及装置。The invention belongs to the technical field of communication, and relates to a method and a device for mutual communication of multiple types of ports.

背景技术Background technique

以太网口、CAN口、串口日益广泛用于装置通信端口,然而由于它们所使用技术规范不同,不能直接相互通信。但是许多地方需要多个具有不同类型端口的装置相互通信,这就需要一种能够实现多个不介质端口之间相互通信的接入装置,而目前还没有能够实现该功能的通信方法和装置。Ethernet ports, CAN ports, and serial ports are increasingly widely used as device communication ports. However, due to the different technical specifications they use, they cannot directly communicate with each other. However, many places require multiple devices with different types of ports to communicate with each other, which requires an access device capable of realizing mutual communication between multiple non-media ports, and there is no communication method and device that can realize this function at present.

申请号为201210222281.6的中国专利申请公开了一种基于串口通信的交互方法及装置,仅实现了同介质串口的一对多的通信,而无法实现串口与以太网口、CAN口与以太网口和串口与CAN口等多种不同类型端口之间的相互通信。The Chinese patent application with the application number 201210222281.6 discloses an interactive method and device based on serial port communication, which only realizes the one-to-many communication of the serial port of the same medium, but cannot realize the communication between the serial port and the Ethernet port, CAN port and Ethernet port. Mutual communication between various types of ports such as serial port and CAN port.

发明内容Contents of the invention

本发明的目的是提供一种多类型端口相互通信的方法及装置,以实现不同类型端口的装置之间相互通信。The object of the present invention is to provide a method and device for communicating with multiple types of ports, so as to realize the mutual communication between devices with different types of ports.

为实现上述目的,本发明的多类型端口相互通信的装置技术方案如下:包括转发模块和至少两种不同类型端口,其中一种类型的端口作为直接接收报文的源端口,该源端口包括存储报文的存储单元、将报文加上源端口号及报文长度发送到转发模块的转发单元,转发模块包括查找转发表找到不同于源端口类型的目的端口查表单元、判断目的端口为源端口生成的发送缓冲区剩余空间能存下要接收的报文的判断单元,源端口还包括发送报文到该发送缓冲区的发送单元,目的端口包括将发送缓冲区中的数据根据其端口类型转换成相应格式的报文并转发出去转换、转发单元。In order to achieve the above object, the technical scheme of the device for multi-type port communication of the present invention is as follows: it includes a forwarding module and at least two different types of ports, wherein one type of port is used as a source port for directly receiving messages, and the source port includes storage The storage unit of the message, the forwarding unit that sends the message plus the source port number and the length of the message to the forwarding module, the forwarding module includes searching the forwarding table to find the destination port lookup unit that is different from the source port type, and judging that the destination port is the source The remaining space of the sending buffer generated by the port can store the judgment unit for the message to be received. The source port also includes the sending unit that sends the message to the sending buffer, and the destination port includes the data in the sending buffer according to its port type. Convert the message into the corresponding format and forward it to the conversion and forwarding unit.

所述至少两种不同类型端口为太网口、CAN口和串口。The at least two different types of ports are Ethernet port, CAN port and serial port.

装置还包括时标模块和通过将被镜像口的报文发送的镜像口的监视模块。The device also includes a time stamp module and a monitor module of the mirror port through which the messages of the mirror port are sent.

本发明的多类型端口相互通信的方法包括如下步骤:The method for multi-type port mutual communication of the present invention comprises the following steps:

(1)把源端口收到的报文存储到该端口的接收缓冲区;(1) Store the message received by the source port into the receiving buffer of the port;

(2)将接收到的报文加上源端口号及要发送报文的长度发送到转发模块;(2) Send the received message plus the source port number and the length of the message to be sent to the forwarding module;

(3)转发模块根据接收到的信息查找转发表,判断该信息中的源端口是否有要转发的不同于源端口类型的目的端口,若是没有,则不转发报文;若是有,则判断目的端口为源端口生成的发送缓冲区剩余空间是否能存下要接收的报文,若是能,则源端口发送报文到该发送缓冲区,若是不能,则等该发送缓冲区满足条件后再转发;(3) The forwarding module searches the forwarding table according to the received information, and judges whether the source port in the information has a destination port to be forwarded that is different from the source port type. If not, the packet is not forwarded; The port is whether the remaining space of the send buffer generated by the source port can store the message to be received. If yes, the source port sends the message to the send buffer. If not, it waits for the send buffer to meet the conditions before forwarding ;

(4)目的端口将发送缓冲区中的数据根据其端口类型,转换成相应格式的报文转发出去,直到发送缓冲区为空。(4) The destination port converts the data in the sending buffer according to its port type into a message of the corresponding format and forwards it until the sending buffer is empty.

进一步的,报文的发送是分段进行的。Further, the message is sent in segments.

进一步的,若源端口是以太网口,则CAN口和/或串口为目的端口;若源端口是CAN口,则以太网口和/或串口为目的端口;若源端口是串口,则以太网口和/或CAN口为目的端口。Further, if the source port is an Ethernet port, the CAN port and/or the serial port are the destination port; if the source port is the CAN port, the Ethernet port and/or the serial port are the destination port; if the source port is a serial port, the Ethernet port and/or CAN port as the destination port.

进一步的,多类型端口相互通信过程中还同时进行监视步骤:被镜像端口直接接收到报文或转发模块发送来的报文后,查找镜像表,得到被镜像端口对应的镜像端口,将直接接收到报文或转发模块发送来的报文加上被镜像端口号及时标,转发到对应的镜像端口。Further, during the mutual communication process of multiple types of ports, the monitoring step is also carried out at the same time: after the mirrored port directly receives the message or the message sent by the forwarding module, it searches the mirroring table to obtain the mirrored port corresponding to the mirrored port, and will directly receive Add the mirrored port number and time stamp to the incoming message or the message sent by the forwarding module, and forward it to the corresponding mirroring port.

本发明的多类型端口相互通信的方法及装置,是从一种源端口收到报文后先存储到缓冲区中,查找转发表,转发到目的端口为源端口生成的发送缓冲区,根据目标端口类型对报文进行处理生成新报文,再由目标端口发出去,解决了多种不同类型端口不能相互转发的问题,实现了不同类型端口的装置相互通信。同时为了对每个端口的收到报文进行监控,还可根据镜像表中的配置选项为被镜像端口接收到的报文加上源的端口号和时标,转发到镜像端口,实现对被镜像端口接收报文进行监控。The method and device for multi-type port communication of the present invention store the message in the buffer after receiving the message from a source port, search the forwarding table, and forward it to the destination port. The port type processes the message to generate a new message, which is then sent out by the target port, which solves the problem that different types of ports cannot forward each other, and realizes the mutual communication between devices with different types of ports. At the same time, in order to monitor the received packets of each port, according to the configuration options in the mirroring table, add the port number and time stamp of the source to the packets received by the mirrored port, and forward them to the mirrored port. The mirror port receives packets for monitoring.

附图说明Description of drawings

图1是多类型端口相互通信的装置实施例的结构示意图;Fig. 1 is a schematic structural diagram of an embodiment of a device in which multiple types of ports communicate with each other;

图2是多类型端口相互通信的方法实施例的报文转发示意图;FIG. 2 is a schematic diagram of message forwarding in an embodiment of a method for mutual communication between multiple types of ports;

图3是多类型端口相互通信的方法的流程图。Fig. 3 is a flowchart of a method for communicating with multiple types of ports.

具体实施方式Detailed ways

一、多类型端口相互通信的装置1. A device for communicating with multiple ports

如图1所示,多类型端口相互通信的装置包括时标模块、转发模块和至少两种不同类型端口(太网口、CAN口和串口),其中一种类型的端口作为直接接收报文的源端口,该源端口包括存储报文的存储单元、将报文加上源端口号及报文长度发送到转发模块的转发单元,转发模块包括查找转发表找到不同于源端口类型的目的端口查表单元、判断目的端口为源端口生成的发送缓冲区剩余空间能存下要接收的报文的判断单元,源端口还包括发送报文到该发送缓冲区的发送单元,目的端口包括将发送缓冲区中的数据根据其端口类型转换成相应格式的报文并转发出去转换、转发单元。装置还包括通过将被镜像口的报文发送的镜像口的监视模块,该监视模块可设于转发模块中。As shown in Figure 1, the device for communicating with multiple types of ports includes a time stamp module, a forwarding module, and at least two different types of ports (Ethernet port, CAN port, and serial port), one of which is used as a port for directly receiving messages Source port, the source port includes a storage unit for storing the message, and a forwarding unit that sends the message plus the source port number and the message length to the forwarding module. The forwarding module includes searching the forwarding table to find a destination port different from the source port type The table unit and judging that the destination port is the judging unit that the remaining space of the sending buffer generated by the source port can store the message to be received, the source port also includes the sending unit that sends the message to the sending buffer, and the destination port includes the sending buffer The data in the zone is converted into a message of the corresponding format according to its port type and forwarded to the conversion and forwarding unit. The device also includes a monitoring module of the mirroring port through which messages from the mirroring port are sent, and the monitoring module can be set in the forwarding module.

本多类型端口相互通信的装置为从源端口收到报文后,把净载荷存储到接收缓冲区中,查找转发表,转发到目的端口为源端口生成的发送缓冲区,目标端口再组织成相应格式的报文发出去。This multi-type port communication device is to store the payload in the receiving buffer after receiving the message from the source port, search the forwarding table, and forward it to the sending buffer generated by the source port for the destination port, and then organize the destination port into The message in the corresponding format is sent out.

1、装置启动后,通过网络自动部署获取转发表及端口号分配表。配置转发表如下表1所示:1. After the device is started, the forwarding table and port number allocation table are obtained through automatic network deployment. Configure the forwarding table as shown in Table 1 below:

表1Table 1

源端口source port 目的端口destination port LAN2LAN2 COM2、COM8、CAN2COM2, COM8, CAN2 COM2COM2 LAN2、CAN1LAN2, CAN1 ……... ……...

配置端口号分配表如下表2所示:Configure the port number allocation table as shown in Table 2 below:

表2Table 2

端口port 端口号The port number LAN1LAN1 101101 ……. …. ……... LAN8LAN8 108108 CAN1CAN1 109109 ……... ……... CAN8CAN8 116116 COM1COM1 117117 ……... ……... COM8COM8 124124

各个端口监听是否有报文到达。如果有端口收到报文,查找转发表,把报文转发到目的端口,目的端口再发送去。Each port monitors whether a packet arrives. If a port receives the packet, it searches the forwarding table, forwards the packet to the destination port, and then sends it to the destination port.

2、根据源端口的类型,转发方式可以分为3类:2. According to the type of source port, forwarding methods can be divided into three categories:

1)以太网口为源端口,以CAN口、串口为目的端口;1) The Ethernet port is the source port, and the CAN port and the serial port are the destination ports;

2)以CAN口为源端口,以以太网口、串口为目的端口;2) Use the CAN port as the source port, and the Ethernet port and serial port as the destination port;

3)以串口为源端口,以以太网口、CAN口为目的端口;3) Take the serial port as the source port, and take the Ethernet port and CAN port as the destination port;

3、根据源端口与目的端口的类型,转发方式可以分为6类种:3. According to the type of source port and destination port, forwarding methods can be divided into 6 types:

1)以以太网口为源端口、以至少一个CAN口为目的端口;1) Take the Ethernet port as the source port and at least one CAN port as the destination port;

2)以以太网口为源端口,以至少一个串口为目的端口;2) Use the Ethernet port as the source port and at least one serial port as the destination port;

3)以CAN口为源端口,以至少一个以太网口为目的端口;3) Use the CAN port as the source port, and at least one Ethernet port as the destination port;

4)以CAN口为源端口,以至少一个串口为目的端口;4) Use the CAN port as the source port, and at least one serial port as the destination port;

5)以串口为源端口,以至少一个以太网口为目的端口;5) Use the serial port as the source port and at least one Ethernet port as the destination port;

6)以串口为源端口,以至少一个CAN口为目的端口。6) Use the serial port as the source port and at least one CAN port as the destination port.

二、多类型端口相互通信的方法2. The method of multi-type ports communicating with each other

如图3所示,多类型端口相互通信的方法步骤如下:As shown in Figure 3, the method steps for multi-type ports to communicate with each other are as follows:

1)把源端口收到的报文存储到该端口的接收缓冲区。1) Store the message received by the source port into the receiving buffer of the port.

2)从接收缓冲区中提取一段数据,加上源端口号及其长度,发送到转发模块,并释放其在接收缓冲区的空间。转发模块查找转发表,判断该端口是否有要转发的目的端口,如果没有,则不转发报文;如果有,判断目的端口为源端口生成的发送缓冲区剩余空间是否大于或等于该段报文的长度,如果是,则源端口发送缓冲区中的一段数据转发到该发送缓冲区,如果不是,则等该发送缓冲区满足条件后再转发。2) Extract a piece of data from the receiving buffer, add the source port number and its length, send it to the forwarding module, and release its space in the receiving buffer. The forwarding module searches the forwarding table to determine whether the port has a destination port to be forwarded. If not, the packet is not forwarded; if yes, it is judged whether the remaining space of the sending buffer generated by the destination port as the source port is greater than or equal to the segment of the packet length, if yes, forward a section of data in the send buffer of the source port to the send buffer, if not, wait for the send buffer to meet the conditions before forwarding.

3)目的端口把发送缓冲区中的数据根据其端口类型,组织成相应格式的报文转发出去。3) The destination port organizes the data in the sending buffer according to its port type into a message of the corresponding format and forwards it.

4)源端口依次把接收缓冲区中的每段数据发送到目的端口,直至发送缓冲区为空。4) The source port sends each piece of data in the receive buffer to the destination port in turn until the send buffer is empty.

镜像功能的实现。选择镜像以太网口,再选择被镜像的以太网口、CAN口和串口。当被镜像端口收到报文后,不加处理直接加上源的端口号及时标,转发到镜像以太网口,实现报文监视功能。Implementation of the mirror function. Select the mirrored Ethernet port, and then select the mirrored Ethernet port, CAN port and serial port. When the mirrored port receives the message, it directly adds the source port number and time stamp without any processing, and forwards it to the mirrored Ethernet port to realize the message monitoring function.

实例1,以LAN2为源端口,以COM2、COM8和CAN2为目的端口,如图2所示。In Example 1, LAN2 is used as the source port, and COM2, COM8 and CAN2 are used as the destination ports, as shown in Figure 2.

1、LAN2通过TCP协议与上位机建立连接,把收到的报文后存储到LAN2接收缓冲区。1. LAN2 establishes a connection with the host computer through the TCP protocol, and stores the received message in the LAN2 receiving buffer.

2、依次从LAN2接收缓冲区中提取一定长度的数据,打上源端口号102及其长度,发送到转发模块,并释放该段数据在LAN2接收缓冲区所占的空间,直至LAN2接收缓冲区为空。2. Extract data of a certain length from the LAN2 receiving buffer in turn, mark the source port number 102 and its length, send it to the forwarding module, and release the space occupied by the data in the LAN2 receiving buffer until the LAN2 receiving buffer is null.

3、转发模块接收到端口号102为的报文后,得知该段数据是从LAN2转发过来的,再查找转发表,得知LAN2所对应的目的端口为COM2、COM8和CAN2。3. After the forwarding module receives the message with the port number 102, it knows that this segment of data is forwarded from LAN2, and then searches the forwarding table, and learns that the destination ports corresponding to LAN2 are COM2, COM8 and CAN2.

4、转发模块查询COM2、COM8和CAN2端口是否为LAN2建立了发送缓冲区,如果没有,则建立相应的发送缓冲区,并把该段数据转发到COM2为LAN2建立的发送缓冲区COM2LAN2发送缓冲区、COM8为LAN2建立的发送缓冲区COM8LAN2发送缓冲区和CAN2为LAN2建立的发送缓冲区CAN2LAN2发送缓冲区;如果有,检查相应的发送缓冲区空间是否大于或等于该段数据的长度,如果是,则转发到相应的发送缓冲区,如果不是,等待到发送缓冲区满足条件后再转发。4. The forwarding module inquires whether COM2, COM8 and CAN2 ports have established sending buffers for LAN2. If not, establish corresponding sending buffers and forward the data to the sending buffer COM2 LAN2 established for LAN2. , COM8 LAN2 send buffer COM8LAN2 send buffer and CAN2 LAN2 send buffer CAN2LAN2 send buffer; if there is, check whether the corresponding send buffer space is greater than or equal to the length of the data, if yes, Then forward to the corresponding sending buffer, if not, wait until the sending buffer meets the conditions before forwarding.

5、COM2、COM8和CAN2端口分别依次从COM2LAN2发送缓冲区、COM8LAN2发送缓冲区和CAN2LAN2发送缓冲区提取一定长度的数据,先在该段数据前面加上源端口号102及其长度组成应用数据,再根据各自的端口类型,转化成相应格式的报文发送出去,直至发送缓冲区为空。5. The COM2, COM8 and CAN2 ports respectively extract data of a certain length from the COM2LAN2 sending buffer, COM8LAN2 sending buffer and CAN2LAN2 sending buffer respectively, first add the source port number 102 and its length in front of the data to form the application data, Then according to the respective port types, convert the message into the corresponding format and send it out until the sending buffer is empty.

实例2,以COM2口为源端口,以LAN2和CAN2为目的端口,如图2所示。In Example 2, COM2 is used as the source port, and LAN2 and CAN2 are used as the destination ports, as shown in Figure 2.

1、COM2口收到的报文后存储到COM2接收缓冲区。1. The message received by the COM2 port is stored in the COM2 receiving buffer.

2、依次从COM2接收缓冲区中提取一定长度的数据,打上源端口号118和长度,发送到转发模块,并释放该段数据在COM2接收缓冲区所占的空间,直到COM2接收缓冲区为空。2. Extract a certain length of data from the COM2 receiving buffer in sequence, mark the source port number 118 and the length, send it to the forwarding module, and release the space occupied by the data in the COM2 receiving buffer until the COM2 receiving buffer is empty .

3、转发模块收到端口号118的报文后,得知该段数据是从COM2转发过来的,再查找转发表,得知LAN2所对应的目的端口为LAN2和CAN2。3. After the forwarding module receives the message with the port number 118, it knows that the segment of data is forwarded from COM2, and then searches the forwarding table, and learns that the destination ports corresponding to LAN2 are LAN2 and CAN2.

4、转发模块查询LAN2和CAN2端口是否为COM2建立了发送缓冲区,如果没有,则建立相应的发送缓冲区,并把该段数据转发到LAN2为COM2建立的LAN2COM2发送缓冲区和CAN2为COM2建立的CAN2COM2发送缓冲区;如果有,检查相应的发送缓冲区空间是否大于或等于该段数据的长度,如果是,则转发到相应的发送缓冲区,如果不是,等待到发送缓冲区满足条件后再转发。4. The forwarding module inquires whether the LAN2 and CAN2 ports have established a sending buffer for COM2. If not, it will establish a corresponding sending buffer and forward this segment of data to the LAN2 COM2 sending buffer established by LAN2 for COM2 and the CAN2 established for COM2. CAN2COM2 send buffer; if there is, check whether the corresponding send buffer space is greater than or equal to the length of the data, if yes, then forward to the corresponding send buffer, if not, wait until the send buffer meets the conditions Forward.

5、LAN2从发送缓冲区LAN2COM2中依次提取一定长度的数据,组织成端口号为118的TCP报文转发出去,直到LAN2COM2发送缓冲区为空。5. LAN2 sequentially extracts data of a certain length from the sending buffer LAN2COM2, organizes them into TCP packets with port number 118 and forwards them until the sending buffer of LAN2COM2 is empty.

6、CAN2口从CAN2COM2发送缓冲区依次提取一段数据,在该段数据前面加上源端口号118及其长度组成应用数据,再组织成CAN格式报文发送出去。6. The CAN2 port extracts a piece of data sequentially from the CAN2COM2 sending buffer, adds the source port number 118 and its length in front of the piece of data to form the application data, and then organizes it into a CAN format message and sends it out.

镜像功能实施例:以LAN1为镜像口,以LAN2和COM2为被镜像口,对LAN2和COM2接收报文进行监控。Example of mirroring function: use LAN1 as the mirroring port, and LAN2 and COM2 as the mirrored ports, and monitor the messages received by LAN2 and COM2.

1、配置镜像表如下:1. Configure the mirror table as follows:

镜像口mirror port 被镜像口mirrored port LAN1LAN1 LAN2、COM2LAN2, COM2

2、LAN2接收到以太网报文或者转发模块发送来的报文后,检查镜像表,得收到的报文要镜像到LAN1口,把以太网报文或者转发模块发送来的报文加上源端口号102及时标,转发到LAN1口。2. After LAN2 receives the Ethernet message or the message sent by the forwarding module, check the mirror table, and the received message must be mirrored to the LAN1 port, and add the Ethernet message or the message sent by the forwarding module to the The source port number is 102 and the time stamp is forwarded to the LAN1 port.

3、COM2接收到串口报文者转发模块发送来的报文后,检查镜像表,得收到的报文要镜像到LAN1口,把串口报文或者转发模块发送来的报文加上源端口号118及时标,转发到LAN1口。3. After COM2 receives the serial port message or the message sent by the forwarding module, check the mirror table, and the received message must be mirrored to the LAN1 port, and add the serial port message or the message sent by the forwarding module to the source port. No. 118 is time stamped and forwarded to LAN1 port.

需要强调的是:上述实施例说明不对本发明作任何形式上的限制,凡是依据本发明的原则对以上实施例所作的任何简单修改、等同变化与修饰,均仍属于本发明技术方案的范围内。It should be emphasized that: the description of the above embodiments does not limit the present invention in any form, and any simple modification, equivalent change and modification made to the above embodiments according to the principles of the present invention still belong to the scope of the technical solution of the present invention .

Claims (7)

1. the device that polymorphic type port is in communication with each other, which is characterized in that including forwarding module and at least two different type ports, The port of one of which type after source port receives message, is arrived net load storage as the source port for directly receiving message It receives in buffering area, which includes the storage unit of stored messages, transmits data to corresponding turn for receiving buffering area Bill member, the lookup forwarding table that forwarding module includes find the lookup unit of the destination interface different from source port type, judge mesh Port can leave the judging units of the data to be received, destination interface packet for the transmission buffering area remaining space of source port generation Include the converting unit that the data sent in buffering area are converted into the message of corresponding format and forwarded according to its port type And retransmission unit;Corresponding reception buffering area is both provided at each source port, corresponding source is both provided at each destination interface The transmission buffering area of port;Forwarding module extraction receives the data in buffering area, in addition source port number and its length, search forwarding Table, judges whether the port has the destination interface to be forwarded, if it is not, not forwarding;If so, judge destination interface for source The length for sending buffering area remaining space and whether being greater than or equal to the segment data of port generation, if it is, will be from source port It sends the one piece of data extracted in buffering area and is forwarded to the transmission buffering area, if it is not, then the transmission buffering area is waited to meet item It is forwarded again after part.

2. the device that polymorphic type port according to claim 1 is in communication with each other, it is characterised in that:Described at least two is different Type port is Ethernet interface, CAN mouthfuls and serial ports.

3. the device that polymorphic type port according to claim 1 or 2 is in communication with each other, it is characterised in that:When device further includes Mark module and the monitoring module by the way that the message for being mirrored port to be sent to mirror port.

4. the method that polymorphic type port is in communication with each other, which is characterized in that this method comprises the following steps:

(1)The reception buffering area of the port is arrived in the net load storage for the message that source port is received;

(2)The data extracted from reception buffering area are sent to forwarding module plus source port number and its length;

(3)Forwarding module searches forwarding table according to the source port number of extraction data, judges whether the source port is forwarded not The destination interface of source port type is same as, if not having, does not then forward data;If having, then judge destination interface for source port Whether the transmission buffering area remaining space of generation can leave the data to be received, if can, then it will be from the corresponding reception of source port The data forwarding extracted in buffering area to the transmission buffering area, if cannot, then wait the transmission buffering area meet condition after turn again Hair;

(4)By the data sent in buffering area according to its port type, the message for being converted into corresponding format transfers destination interface It goes, until sending buffering area as sky;

Corresponding reception buffering area is both provided at each source port, the hair of corresponding source port is both provided at each destination interface Send buffering area.

5. the method that polymorphic type port according to claim 4 is in communication with each other, it is characterised in that:The transmission of message is segmentation It carries out.

6. the method that polymorphic type port according to claim 4 is in communication with each other, it is characterised in that:If source port is Ethernet Mouthful, then CAN mouthful and/or serial ports are purpose port;If source port is CAN mouthfuls, Ethernet interface and/or serial ports are purpose port; If source port is serial ports, Ethernet interface and/or CAN mouthfuls are purpose port.

7. the method that the polymorphic type port according to any one of claim 4-6 is in communication with each other, which is characterized in that polymorphic type Port is also carried out at the same time monitoring step during being in communication with each other:It is mirrored that port directly receives message or forwarding module is sent Message after, search mirror list, obtain being mirrored the corresponding mirror port in port, will directly receive message or forwarding module hair The message sent is forwarded to corresponding mirror port plus port numbers and markers is mirrored.

CN201310625518.XA 2013-11-30 2013-11-30 The method and device that polymorphic type port is in communication with each other Active CN103685028B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310625518.XA CN103685028B (en) 2013-11-30 2013-11-30 The method and device that polymorphic type port is in communication with each other

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310625518.XA CN103685028B (en) 2013-11-30 2013-11-30 The method and device that polymorphic type port is in communication with each other

Publications (2)

Publication Number Publication Date
CN103685028A CN103685028A (en) 2014-03-26
CN103685028B true CN103685028B (en) 2018-06-12

Family

ID=50321386

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310625518.XA Active CN103685028B (en) 2013-11-30 2013-11-30 The method and device that polymorphic type port is in communication with each other

Country Status (1)

Country Link
CN (1) CN103685028B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107102576A (en) * 2016-02-23 2017-08-29 西门子公司 A kind of controller, dcs and method
CN105897622B (en) * 2016-04-06 2019-06-18 深圳市科楠科技开发有限公司 Space remote sensing equipment, signal generator and control method
CN106130991A (en) * 2016-06-30 2016-11-16 北京东土军悦科技有限公司 A kind of data forwarding method and device
CN109714390B (en) * 2018-11-22 2022-04-26 平安科技(深圳)有限公司 Data transmission method, device and equipment for multiple ports
CN110333664B (en) * 2019-07-09 2022-09-09 广汽丰田汽车有限公司 Information processing method and device and computer readable storage medium
CN111698160A (en) * 2019-12-27 2020-09-22 国网上海市电力公司 A ring network system, a data processing method and device for a node in a network system
CN113836048B (en) * 2021-09-17 2024-09-06 许昌许继软件技术有限公司 Data exchange method and device based on FPGA memory dynamic allocation

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1750485A (en) * 2005-07-14 2006-03-22 牛伟 Network simulation detection system and method
CN201750562U (en) * 2010-07-31 2011-02-16 大连工业大学 A device for interconnecting wireless sensor networks with the Internet and mobile communication networks

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100486229C (en) * 2005-02-18 2009-05-06 美国博通公司 Network apparatus and method for data processing in data network
CN101626351A (en) * 2008-07-09 2010-01-13 青岛高校信息产业有限公司 Multiprotocol data acquisition gateway
CN101420386B (en) * 2008-12-09 2011-04-27 南京西倍特科技有限公司 Multi-field integrated metering network interconnecting routing method
CN102611619B (en) * 2012-02-24 2018-03-20 中兴通讯股份有限公司 The method and routing device of a kind of forwarding data packets
CN102819513A (en) * 2012-06-29 2012-12-12 安科智慧城市技术(中国)有限公司 Interactive method and interactive device based on serial port communication

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1750485A (en) * 2005-07-14 2006-03-22 牛伟 Network simulation detection system and method
CN201750562U (en) * 2010-07-31 2011-02-16 大连工业大学 A device for interconnecting wireless sensor networks with the Internet and mobile communication networks

Also Published As

Publication number Publication date
CN103685028A (en) 2014-03-26

Similar Documents

Publication Publication Date Title
CN103685028B (en) 2018-06-12 The method and device that polymorphic type port is in communication with each other
JP5859669B2 (en) 2016-02-10 Packet ordering based on delivery route changes in communication networks
US10615997B2 (en) 2020-04-07 In-vehicle gateway device
CN104283806B (en) 2018-01-12 Business chain processing method and equipment
US9319241B2 (en) 2016-04-19 Flow-based packet transport device and packet management method thereof
CN102801820B (en) 2015-01-28 MAC address publishing method and device in EVI network
CN104038425B (en) 2018-01-02 The method and apparatus for forwarding ether network packet
US10447798B2 (en) 2019-10-15 Communication system permitting reduction of amount of data of route information included in packet, communication method, and relay device of communication system
CN103763407A (en) 2014-04-30 Method for achieving address resolution protocol proxy through two-layer virtual local area network and local area network system
CN104468866A (en) 2015-03-25 Fast roaming method for multi-gateway terminal in wireless local area network
CN102014045A (en) 2011-04-13 Exchanger and method for controlling flow of same
CN104521220B (en) 2017-06-20 Message processing method and equipment
CN106899500B (en) 2020-06-26 Message processing method and device for cross-virtual extensible local area network
CN105337855A (en) 2016-02-17 Method and device used for processing modified message
JP2017050774A (en) 2017-03-09 Gateway device and calculation device
JP2013515407A5 (en) 2014-01-09
CN105187311A (en) 2015-12-23 Message forwarding method and message forwarding device
JP2014123363A5 (en) 2015-03-12
CN104135548A (en) 2014-11-05 Static NAT realization method and device based on FPGA
CN103067278A (en) 2013-04-24 Data frame transmission processing method, equipment and system
CN104168273B (en) 2017-10-31 The method and system of TCP agent are realized under a kind of thin ap mode
CN101873235A (en) 2010-10-27 Detection method of equipment network link, network management system and network system
CN103281317A (en) 2013-09-04 Attack testing method for SDN (software defined network)
CN106533503A (en) 2017-03-22 Method and device for power line network communication
CN102938885A (en) 2013-02-20 Method for interconnecting and intercommunicating identity and location separating network and traditional network, identity location register (ILR) and access service router (ASR)

Legal Events

Date Code Title Description
2014-03-26 PB01 Publication
2014-03-26 PB01 Publication
2014-04-23 C10 Entry into substantive examination
2014-04-23 SE01 Entry into force of request for substantive examination
2018-06-12 GR01 Patent grant
2018-06-12 GR01 Patent grant