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

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
buffering area
message
source port
source
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.)
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.)
Filing date
Publication date
Application filed by XJ Electric Co Ltd, Xuchang XJ Software Technology Co Ltd filed Critical XJ Electric Co Ltd
Priority to CN201310625518.XA priority Critical patent/CN103685028B/en
Publication of CN103685028A publication Critical patent/CN103685028A/en
Application granted granted Critical
Publication of CN103685028B publication Critical patent/CN103685028B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention relates to the method and device that polymorphic type port is in communication with each other, the packet storage that source port receives to reception buffering area;The length that the message received is added source port number and to send message is sent to forwarding module;Forwarding module judges whether source port has the destination interface different from source port type to be forwarded, if not having, does not then E-Packet according to the information searching forwarding table received;If having, then judge whether the transmission buffering area remaining space that destination interface is generated for source port can leave the message to be received, if can, then source port sends message to the transmission buffering area, if cannot, then the transmission buffering area is waited to be forwarded again after meeting condition;By the data sent in buffering area according to its port type, the message for being converted into corresponding format forwards destination interface, until sending buffering area as sky;The present invention solves the problems, such as that a variety of different type ports cannot mutually forward, and the device for realizing different type port is in communication with each other.

Description

The method and device that polymorphic type port is in communication with each other
Technical field
The invention belongs to fields of communication technology, are related to the method and device that a kind of polymorphic type port is in communication with each other.
Background technology
Ethernet interface, CAN mouthfuls, serial ports it is increasingly extensive for device communication port, advised however, as their institutes using technology Model is different, it is impossible to directly be in communication with each other.But many places need multiple devices with different type port to be in communication with each other, this With regard to needing a kind of access device for the intercommunication that can realize multiple not media ports, and there is presently no can realize this The communication means and device of function.
Chinese patent application application No. is 201210222281.6 discloses a kind of exchange method based on serial communication And device, the one-to-many communication of same medium serial ports is only realized, and can not realize serial ports and Ethernet interface, CAN mouthfuls and ether Being in communication with each other between a variety of different type ports such as network interface and serial ports and CAN mouthful.
Invention content
The object of the present invention is to provide the method and device that a kind of polymorphic type port is in communication with each other, to realize different type end The intercommunication of the device of mouth.
To achieve the above object, the device technique scheme that polymorphic type port of the invention is in communication with each other is as follows:Including forwarding Module and at least two different type ports, the port of one of which type is as the source port for directly receiving message, the source Mouth includes the storage unit of stored messages, message is sent to the forwarding list of forwarding module plus source port number and message length Member, forwarding module include lookup forwarding table and find the destination interface lookup unit different from source port type, judge destination interface Transmission buffering area remaining space for source port generation can leave the judging unit for the message to be received, and source port further includes transmission Message is to the transmitting element of the transmission buffering area, and destination interface will be including that will send the data in buffering area according to its port type turn It changes the message of corresponding format into and forwards conversion, retransmission unit.
At least two different types port is too network interface, CAN mouthfuls and serial ports.
The monitoring module of mirror port that device further includes markers module and sent by that will be mirrored the message of mouth.
The method that the polymorphic type port of the present invention is in communication with each other includes the following steps:
(1)The reception buffering area of the packet storage that source port receives to the port;
(2)The length that the message received is added source port number and to send message is sent to forwarding module;
(3)According to the information searching forwarding table received, judging whether the source port in the information has will turn forwarding module The destination interface different from source port type of hair, if not having, does not then E-Packet;If having, then judge that destination interface is Whether the transmission buffering area remaining space of source port generation can leave the message to be received, if can, then source port sends message To the transmission buffering area, if cannot, then the transmission buffering area is waited to be forwarded again after meeting condition;
(4)By the data sent in buffering area according to its port type, the message for being converted into corresponding format turns destination interface It sends out, until sending buffering area as sky.
Further, the transmission of message is that segmentation carries out.
Further, if source port is Ethernet interface, CAN mouthfuls and/or serial ports are purpose port;If source port is CAN Mouthful, then Ethernet interface and/or serial ports are purpose port;If source port is serial ports, held for the purpose of Ethernet interface and/or CAN mouthfuls Mouthful.
Further, polymorphic type port is also carried out at the same time monitoring step during being in communication with each other:Port is mirrored directly to connect After receiving the message that message or forwarding module are sent, mirror list is searched, obtains being mirrored the corresponding mirror port in port, it will be straight Message that message or forwarding module send is received plus port numbers and markers is mirrored, is forwarded to corresponding mirror image end Mouthful.
The method and device that the polymorphic type port of the present invention is in communication with each other, is first stored after receiving message from a kind of source port Into buffering area, forwarding table is searched, the transmission buffering area that destination interface is source port generation is forwarded to, according to destination port type Processing is carried out to message and generates new message, then sent out by target port, solving a variety of different type ports cannot mutually turn The problem of hair, the device for realizing different type port are in communication with each other.Simultaneously in order to which the message that receives to each port is supervised Control can also be to be mirrored port numbers and markers that the message that port receives adds source according to the config option in mirror list, turn Mirror port is dealt into, realizes and is monitored to being mirrored port reception message.
Description of the drawings
Fig. 1 is the structure diagram for the device embodiment that polymorphic type port is in communication with each other;
Fig. 2 is the message forwarding schematic diagram for the embodiment of the method that polymorphic type port is in communication with each other;
Fig. 3 is the flow chart for the method that polymorphic type port is in communication with each other.
Specific embodiment
First, the device that polymorphic type port is in communication with each other
As shown in Figure 1, the device that polymorphic type port is in communication with each other includes markers module, forwarding module and at least two differences Type port(Too network interface, CAN mouthfuls and serial ports), the port of one of which type is as the source port for directly receiving message, the source Port includes the storage unit of stored messages, message is sent to the forwarding list of forwarding module plus source port number and message length Member, forwarding module include lookup forwarding table and find the destination interface lookup unit different from source port type, judge destination interface Transmission buffering area remaining space for source port generation can leave the judging unit for the message to be received, and source port further includes transmission Message is to the transmitting element of the transmission buffering area, and destination interface will be including that will send the data in buffering area according to its port type turn It changes the message of corresponding format into and forwards conversion, retransmission unit.Device is further included to be sent by the message that will be mirrored mouth Mirror port monitoring module, the monitoring module can be set on forwarding module in.
The device that this polymorphic type port is in communication with each other is after source port receives message, and net load storage is buffered to reception Qu Zhong searches forwarding table, is forwarded to the transmission buffering area that destination interface is source port generation, and target port is organized into corresponding lattice again The message of formula is sent out.
1st, after device starts, forwarding table and port number assignment table are obtained by network automatic deployment.It is as follows that forwarding table is configured Shown in table 1:
Table 1
Source port Destination interface
LAN2 COM2、COM8、CAN2
COM2 LAN2、CAN1
…… ……
It is as shown in table 2 below that port number assignment table is configured:
Table 2
Port Port numbers
LAN1 101
…… . ……
LAN8 108
CAN1 109
…… ……
CAN8 116
COM1 117
…… ……
COM8 124
Whether each port snoop has message arrival.If there is port receives message, forwarding table is searched, message is forwarded to Destination interface, destination interface retransmit.
2nd, according to the type of source port, pass-through mode can be divided into 3 classes:
1)Ethernet interface is source port, using CAN mouthfuls, serial ports as purpose port;
2)With CAN mouthfuls for source port, using Ethernet interface, serial ports as purpose port;
3)Using serial ports as source port, with Ethernet interface, CAN mouthfuls for purpose port;
3rd, according to the type of source port and destination interface, pass-through mode can be divided into 6 class kinds:
1)It is purpose port using Ethernet interface as source port, at least one CAN mouthfuls;
2)Using Ethernet interface as source port, using at least one serial ports as purpose port;
3)With CAN mouthfuls for source port, using at least one Ethernet interface as purpose port;
4)With CAN mouthfuls for source port, using at least one serial ports as purpose port;
5)Using serial ports as source port, using at least one Ethernet interface as purpose port;
6)Using serial ports as source port, at least one CAN mouthfuls for purpose port.
2nd, the method that polymorphic type port is in communication with each other
As shown in figure 3, the method and step that polymorphic type port is in communication with each other is as follows:
1)The reception buffering area of the packet storage that source port receives to the port.
2)One piece of data is extracted from receiving in buffering area, in addition source port number and its length, are sent to forwarding module, and release It is put in the space for receiving buffering area.Forwarding module searches forwarding table, judges whether the port has the destination interface to be forwarded, such as Fruit does not have, then does not E-Packet;If so, judge whether the transmission buffering area remaining space that destination interface is generated for source port is big In or equal to this section of message length, if it is, source port send buffering area in one piece of data be forwarded to the transmission buffering Area, if it is not, then the transmission buffering area is waited to be forwarded again after meeting condition.
3)Data in transmission buffering area according to its port type, are organized into the message forwarding of corresponding format by destination interface It goes out.
4)Every segment data in reception buffering area is sent to destination interface by source port successively, until transmission buffering area is It is empty.
The realization of image feature.Select mirror image Ethernet interface, Ethernet interface that reselection is mirrored, CAN mouthfuls and serial ports.When It is mirrored after port receives message, the untreated port numbers and markers for directly adding source are forwarded to mirror image Ethernet interface, realize Protocol monitor function.
Example 1, using LAN2 as source port, using COM2, COM8 and CAN2 as purpose port, as shown in Figure 2.
1st, LAN2 is established by Transmission Control Protocol and host computer and connected, and storage after the message received is received buffering area to LAN2.
2nd, the data that certain length is extracted in buffering area are received from LAN2 successively, stamp source port number 102 and its length, are sent out Forwarding module is sent to, and discharges the segment data and receives the space shared by buffering area in LAN2, until LAN2 receives buffering area as sky.
3rd, after forwarding module receives the message that port numbers 102 are, learn that the segment data is forwarded from LAN2, then Forwarding table is searched, it is COM2, COM8 and CAN2 to learn the destination interface corresponding to LAN2.
4th, whether forwarding module inquiry COM2, COM8 and CAN2 ports are that LAN2 establishes transmission buffering area, if not provided, Corresponding transmission buffering area is then established, and it is that the transmission buffering area COM2LAN2 that LAN2 is established is sent out that the segment data, which is forwarded to COM2, It is that the transmission that the transmission buffering area COM8LAN2 that LAN2 is established sends buffering area and CAN2 is LAN2 foundation is delayed to send buffering area, COM8 It rushes area CAN2LAN2 and sends buffering area;If so, check the corresponding buffer space that sends whether more than or equal to the segment data Length, if it is, be forwarded to it is corresponding send buffering area, meet after condition again until sending buffering area if it is not, waiting Forwarding.
5th, COM2, COM8 and CAN2 port are respectively successively from COM2LAN2 sends buffering area, COM8LAN2 sends buffering area The data of buffering area extraction certain length are sent with CAN2LAN2, first plus source port number 102 and its length before the segment data Degree composition is using data, and further according to respective port type, the message for being converted to corresponding format is sent, until sending buffering Area is sky.
Example 2, with COM2 mouthfuls for source port, using LAN2 and CAN2 as purpose port, as shown in Figure 2.
1st, storage receives buffering area to COM2 after the COM2 mouthfuls of messages received.
2nd, the data that certain length is extracted in buffering area are received from COM2 successively, stamp source port number 118 and length, are sent It to forwarding module, and discharges the segment data and receives the space shared by buffering area in COM2, until COM2 receives buffering area as sky.
3rd, after forwarding module receives the message of port numbers 118, learn that the segment data is forwarded from COM2, then is searched Forwarding table, it is LAN2 and CAN2 to learn the destination interface corresponding to LAN2.
4th, whether forwarding module inquiry LAN2 and CAN2 ports are that COM2 establishes transmission buffering area, if it is not, building Vertical corresponding transmission buffering area, and it is that the LAN2COM2 that COM2 is established sends buffering area and CAN2 that the segment data, which is forwarded to LAN2, Buffering area is sent for the COM2 CAN2COM2 established;If so, checking whether corresponding transmission buffer space is greater than or equal to The length of the segment data if it is, being forwarded to corresponding transmission buffering area, meets if it is not, waiting until sending buffering area It is forwarded again after condition.
5th, LAN2 extracts the data of certain length successively from transmission buffering area LAN2COM2, and it is 118 to be organized into port numbers TCP message forward, until LAN2COM2 send buffering area for sky.
6th, one piece of data is extracted successively from CAN2COM2 transmission buffering areas for CAN2 mouthfuls, source port is added before the segment data Numbers 118 and its length composition using data, then be organized into CAN form messages and send.
Image feature embodiment:Using LAN1 as mirror port, using LAN2 and COM2 as mouth is mirrored, LAN2 and COM2 is received Message is monitored.
1st, configuration mirroring table is as follows:
Mirror port It is mirrored mouth
LAN1 LAN2、COM2
2nd, it after LAN2 receives the message that ether network packet or forwarding module are sent, checks mirror list, must receive Message will be mirrored to LAN1 mouthfuls, and the message that ether network packet or forwarding module are sent adds source port number 102 and markers, It is forwarded to LAN1 mouthfuls.
3rd, after COM2 receives the message that serial ports message person's forwarding module is sent, mirror list, the message that must be received are checked LAN1 mouthfuls are mirrored to, the message that serial ports message or forwarding module are sent adds source port number 118 and markers, is forwarded to LAN1 mouthfuls.
It is emphasized that:Above-described embodiment illustrates not make the present invention limitation in any form, every according to this hair Any simple modification, equivalent change and modification that bright principle makees above example, still falls within technical solution of the present invention In the range of.

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 国网上海市电力公司 Ring network system, and data processing method and device of nodes in network system
CN113836048A (en) * 2021-09-17 2021-12-24 许昌许继软件技术有限公司 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 大连工业大学 Device for interconnecting the wireless sensor network with the internet and the mobile communication net

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 大连工业大学 Device for interconnecting the wireless sensor network with the internet and the mobile communication net

Also Published As

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

Similar Documents

Publication Publication Date Title
CN103685028B (en) The method and device that polymorphic type port is in communication with each other
CN103490966B (en) A kind of dual-redundant CAN bus method for receiving and processing data
CN103929461B (en) Mac address information synchronous method and device in pile system
CN101577722B (en) Method for realizing MAC forced forwarding function and device
CN101552785B (en) CAN bus communication method based on message mechanism used for massive data transmission
CN101990238A (en) Method for aggregating sensor network data
CN103763407A (en) Method for achieving address resolution protocol proxy through two-layer virtual local area network and local area network system
CN105991445A (en) Link aggregation group setting method and device
CN106131028B (en) A kind of data transmission method of Free-port communication gateway
CN103997530A (en) Communication system of elevator internet of things and data sending method
CN106899500B (en) Message processing method and device for cross-virtual extensible local area network
CN107947994B (en) Network topology self-discovery method and device, network equipment and computer storage medium
CN104468776A (en) Method for achieving sensor network data transmission and sink nodes
CN102014045A (en) Exchanger and method for controlling flow of same
JP2019195154A (en) Multi-gateway communication method and radio gateway system thereof
CN107179754B (en) A kind of multi-line system and its centralized management method
CN103973414B (en) A kind of data transmission method and device
CN102209040A (en) Multi-network-port-based load sharing method and device
CN103929377A (en) Wired network and wireless network combined dispatching method and system and related devices
CN109076635A (en) Can redundancy running industrial communication systems, for its operation method and radio-subscriber station
CN104168273B (en) The method and system of TCP agent are realized under a kind of thin ap mode
CN101873235A (en) Detection method of equipment network link, network management system and network system
CN102104533B (en) Method for optimizing RRPP (rapid ring protection protocol) single ring network data transmitting path and ring network node
CN101909009A (en) Routing method, routing system and service gateway in intelligent home system
CN102088464A (en) Protocol device and method for achieving data transmission of objects or apparatuses of various kinds of buses

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant