CN100438438C - Method for maintaining network entity interface state - Google Patents
Method for maintaining network entity interface state Download PDFInfo
- Publication number
- CN100438438C CN100438438C CNB2006100337078A CN200610033707A CN100438438C CN 100438438 C CN100438438 C CN 100438438C CN B2006100337078 A CNB2006100337078 A CN B2006100337078A CN 200610033707 A CN200610033707 A CN 200610033707A CN 100438438 C CN100438438 C CN 100438438C
- Authority
- CN
- China
- Prior art keywords
- connection
- journey
- sequence number
- take
- hair line
- 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
Links
Images
Abstract
The present invention relates to a method for maintaining network entity interface states, which comprises: when the connection between a receiving thread and a sending thread is established again, the switching of interface states is recorded; when the abnormal state of the network connection is detected by the receiving thread, the receiving thread judges whether the connection is established again according to the switching record; serial numbers for identifying the switching states are set, and the serial numbers are modified when the connection between the receiving thread and the sending thread is established again; when the abnormal state of the network connection is detected by the receiving thread, whether the current serial numbers are same with the recorded serial numbers is judged, if true, the connection is established again. When the abnormal state of the network connection is detected by the sending thread, whether the current serial numbers are same with the recorded serial numbers is judged, if true, the connection is established again. The present invention realizes the function of judging whether the connection is established again according to the switching records of the interface states. As a result, the present invention can effectively avoid the abnormal migration of the interface states, save system resources and enhance system efficiency and reliability.
Description
Technical field
The present invention relates to a kind of method of maintaining network entity interface state, especially a kind of network entity interface is by the method for take-up journey and hair line journey maintenance interface connection status.
Background technology
When network entity was interconnected, the iostream by socket (socket) carried out exchanges data usually.End equipment sends data to the opposite end by output stream, read the data that send the opposite end by inlet flow, owing to need handle respectively the data of input and output both direction, general equipment can divide different threads to realize above-mentioned two kinds of operations, safeguards the state that connects in the sending and receiving thread simultaneously.
Opposite end to be read data such as take-up Cheng Ze, when network connects when unusual, the take-up journey can detect connect unusual, thereby carry out the migration and the maintenance of state.As shown in Figure 1, for take-up journey in the prior art connecting the method flow diagram that carries out state-maintenance when unusual, comprise the steps:
The hair line journey is responsible for when application layer has data to send to the opposite end, detects connection status, if connection status is normal, then sends data, if connection status is unusual, rebulids connection and sends data.As shown in Figure 2, the method flow diagram for hair line journey transmission data in the prior art comprises the steps:
Whether step 22, hair line journey are declared the circuit network connection unusual, if unusual, execution in step 23, otherwise, execution in step 24;
Network interface receives by take-up journey and hair line journey and sends data, and receiving or sending thread is safeguarded connection status jointly, and when the generation network was unusual, each thread synchronization was safeguarded connection status.
In the ordinary course of things, network takes place when unusual, and the take-up journey detects mistake at first, and recovers physical connection, guarantees that when the hair line journey sent data, it was normal that network connects.But under rare occasion, network just in time takes place unusual when sending data, this moment the hair line journey detect network unusual after, for the reliability that guarantees that data send, can rebulid physical connection and send data, meanwhile, the take-up journey can find that also network is unusual, so rebuild in the process of physical connection in the hair line journey, the take-up journey may also go to finish this and rebuild action, connection status is all being safeguarded in both sides, causes state to be repeated migration.For example, to detect network connection state normal for the hair line journey in step 21, and in the execution in step 24, network connect take place unusual, at this moment, the hair line journey all can detect network with the take-up journey and be connected unusually, and hair line journey meeting execution in step 23 rebulids connection, and the take-up journey can carry out 11, rebulid connection, then can duplicate the situation of building connection, and it is just passable in fact only to need the hair line journey to connect.Though thisly repeat to connect, expended systematic function to the not influence of transmitting and receiving data function meaninglessly.
Summary of the invention
The objective of the invention is in the prior art, when the connection status of multithreading while maintaining network entity, the once connection that may occur causes the problem of repeatedly state transition unusually, a kind of method of maintaining network entity interface state is provided, avoid the meaningless migration of state, conserve system resources improves system effectiveness and reliability.
To achieve these goals, the invention provides a kind of method of maintaining network entity interface state, this method comprises: record is carried out in the switching of take-up journey and hair line journey docking port state when rebuilding connection, the take-up journey connects when unusual detecting network, if current sequence number is identical with the sequence number of record, rebulid connection; If different, do not rebulid connection.
A pair of state can be set switch the sequence number that identifies, take-up journey and hair line journey are when rebuilding connection, by revising the switching that this sequence number comes the record interface state.The modification sequence number can be: sequence number is increased progressively or sequence number is set to a value that produces at random.
Described take-up journey connects when unusual detecting network, judge whether that according to switching record needs rebuild step of connecting and be specially: the take-up journey detects network and connects when unusual, judge whether current sequence number is identical with the sequence number of record, if it is identical, then need to rebuild and connect, if different, then need not rebuild connection.
This method also comprises: described hair line journey connects when unusual detecting network, judges whether that needs are rebuild and connects according to switching record.This step is specially: the hair line journey detects network and connects when unusual, judges whether current sequence number is identical with the sequence number of record, if identical, then need to rebuild and connects, if different, then need not rebuild connection.
The present invention has realized judging whether to rebuild according to the switching of Interface status record connecting, thereby can effectively avoid the meaningless migration of Interface status, but and conserve system resources, improve system effectiveness and reliability.
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Description of drawings
Fig. 1 carries out the method flow diagram of state-maintenance when connection is unusual for take-up journey in the prior art;
Fig. 2 is the method flow diagram that the hair line journey sends data in the prior art;
Fig. 3 carries out the method flow diagram of state-maintenance when connection is unusual for take-up journey of the present invention;
Fig. 4 is that hair line journey of the present invention sends data flowchart;
Fig. 5 carries out the method flow diagram of state-maintenance according to sequence number when connection is unusual for hair line journey of the present invention.
Embodiment
When maintaining network entity interface state, it is not reentrant rebuilding the process that connects, and that is to say that the hair line journey can't be rebuild connection when the take-up journey is rebuild connection, and when the reconstruction of hair line journey connected, the take-up journey also can't enter the process that connects of rebuilding.Therefore, but record is carried out in the switching of docking port state, realizes the synchronous of cross-thread Interface status, avoids meaningless state transition.
When the state of maintaining network interface, generally be to represent certain state by forms such as specific numerical value, objects, no matter the state of network interface is represented in which way, can on this method for expressing, increase a latitude, be used for state switching carrying out record.For example, when certain system represents the state of a network interface by numerical value: STATUS=0 represents initialization; STATUS=1 represents connection status; STATUS=2 represents off-state, increases the state that switches record and can pass through one-dimension array STATUS[] expression, STATUS[0] be state value, STATUS[1] be the switching record of state; When certain system represented state by object: STATUS.STATE=INIT represented initialization; STATUS.STATE=CONNECTED represents connection status; STATUS.STATE=DISCONNECTED represents off-state, so, can increase the switching that member STATUS.SEQUENCEID comes recording status in STATUS.
Switching record can represent by sequence number.Sequence number can be the string representation that maybe can convert numeral by integer to, and when connection status was switched, the modification sequence number also recorded in the state.The modification of sequence number can increase progressively for sequence number, perhaps is set to a value that produces at random for sequence number.Switching record and also can represent by other modes, as long as guarantee when state switches, can be that the value different with current record gets final product with switching record modification.
Below the method for carrying out the Interface status maintenance according to sequence number is elaborated.
As shown in Figure 3, for the take-up journey is connecting the method flow diagram that carries out state-maintenance when unusual, carry out following steps:
If identical, illustrate that the hair line journey do not rebuild connection, state is migration not, so the take-up journey need be carried out the reconstruction step of connecting.If different, illustrate that the hair line journey has rebulid connection, therefore, the take-up journey need not rebuild connection.
The modification of sequence number can be for increasing progressively, or be set to a value that generates at random.
As shown in Figure 4, for the hair line journey sends data flowchart, when having data to send, the hair line journey is carried out following steps:
Accept data because the take-up journey is blocked wait always, take place unusually in case connect, most of situation all is that the take-up journey is found at first, and connection is rebulid success.Therefore, the hair line journey is when sending data, and it is normal connecting under most of situation, have only under few situation,, connect and take place unusually in the moment that sends message, sending thread could connect unusually in perception, through test, generally all is that the hair line journey is built up connection at first in this case.But, if the take-up journey is built up earlier, the meaningless migration of state so also can take place, therefore, can also add judgement in the hair line journey to sequence number, thereby, can more effectively avoid the meaningless migration of state.
As shown in Figure 5, when connection is unusual, carry out the method flow diagram of state-maintenance according to sequence number for the hair line journey.When the hair line journey need send in data,, carry out following steps if run into the unusual situation that connects:
If identical, illustrate that the take-up journey do not rebuild connection, state is migration not, so the hair line journey need be carried out the reconstruction step of connecting.If different, illustrate that the take-up journey has rebulid connection, therefore, the hair line journey need not rebuild connection.
Step 302, hair line journey are rebuild and are connected, and carry out the connection status change, revise sequence number and record;
The present invention can number carry out the communication of cross-thread according to status switch, judges unnecessary state transition situation, avoids unnecessary consumption, thereby improves system effectiveness and reliability.
Should be noted that at last: above embodiment is only in order to illustrate that technical scheme of the present invention is not intended to limit; Although with reference to preferred embodiment the present invention is had been described in detail, those of ordinary skill in the field should be appreciated that still and can make amendment or the part technical characterictic is equal to replacement the specific embodiment of the present invention; And not breaking away from the spirit of technical solution of the present invention, it all should be encompassed in the middle of the technical scheme scope that the present invention asks for protection.
Claims (7)
1, a kind of method of maintaining network entity interface state, it is characterized in that, this method comprises: record is carried out in the switching of take-up journey and hair line journey docking port state when rebuilding connection, the take-up journey connects when unusual detecting network, if current sequence number is identical with the sequence number of record, rebulid connection; If different, do not rebulid connection.
2, method according to claim 1, it is characterized in that, be provided with state is switched the sequence number that identifies, the step that the switching of described take-up journey and hair line journey docking port state when rebuilding connection is write down is specially: take-up journey and hair line journey are revised this sequence number when rebuilding connection.
3, method according to claim 2 is characterized in that, the step of described modification sequence number is specially: sequence number is increased progressively.
4, method according to claim 2 is characterized in that, the step of described modification sequence number is specially: sequence number is set to a value that produces at random.
5, according to the arbitrary described method of claim 2 to 4, it is characterized in that, described take-up journey connects when unusual detecting network, judge whether that according to switching record needs rebuild step of connecting and be specially: the take-up journey detects network and connects when unusual, judge whether current sequence number is identical with the sequence number of record,, then need to rebuild connection if identical, if different, then need not rebuild connection.
6, method according to claim 5 is characterized in that, this method also comprises: described hair line journey connects when unusual detecting network, judges whether that needs are rebuild and connects according to switching record.
7, method according to claim 6, it is characterized in that, described hair line journey connects when unusual detecting network, judge whether that according to switching record needs rebuild step of connecting and be specially: the hair line journey detects network and connects when unusual, judge whether current sequence number is identical with the sequence number of record,, then need to rebuild connection if identical, if different, then need not rebuild connection.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2006100337078A CN100438438C (en) | 2006-02-15 | 2006-02-15 | Method for maintaining network entity interface state |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2006100337078A CN100438438C (en) | 2006-02-15 | 2006-02-15 | Method for maintaining network entity interface state |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1863091A CN1863091A (en) | 2006-11-15 |
CN100438438C true CN100438438C (en) | 2008-11-26 |
Family
ID=37390424
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2006100337078A Expired - Fee Related CN100438438C (en) | 2006-02-15 | 2006-02-15 | Method for maintaining network entity interface state |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100438438C (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102111419B (en) * | 2011-03-07 | 2014-06-25 | 浙江大学 | Message middleware-based client automatic reconnection method |
CN104836683B (en) * | 2015-04-01 | 2018-06-05 | 上海大唐移动通信设备有限公司 | A kind of method and device of thread reconnection |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040003085A1 (en) * | 2002-06-26 | 2004-01-01 | Joseph Paul G. | Active application socket management |
CN1725757A (en) * | 2004-07-21 | 2006-01-25 | 三星电子株式会社 | Management is connected with the inspection socket |
-
2006
- 2006-02-15 CN CNB2006100337078A patent/CN100438438C/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040003085A1 (en) * | 2002-06-26 | 2004-01-01 | Joseph Paul G. | Active application socket management |
CN1725757A (en) * | 2004-07-21 | 2006-01-25 | 三星电子株式会社 | Management is connected with the inspection socket |
Non-Patent Citations (10)
Title |
---|
Unix套接口编程中的核心概念分析. 杜智华.新疆师范大学学报(自然科学版),第19卷第4期. 2000 |
Unix套接口编程中的核心概念分析. 杜智华.新疆师范大学学报(自然科学版),第19卷第4期. 2000 * |
一种带有断开恢复功能的Socket通信方法. 薛海强,苏森.计算机应用研究,第10期. 2005 |
一种带有断开恢复功能的Socket通信方法. 薛海强,苏森.计算机应用研究,第10期. 2005 * |
基于SOCKET 编程接口的网络通信. 李德水.渭南师范学院学报,第20卷第2期. 2005 |
基于SOCKET 编程接口的网络通信. 李德水.渭南师范学院学报,第20卷第2期. 2005 * |
网络通信接口--Windows Socket 及其应用. 李南方.武钢职工大学学报,第12卷第1期. 2000 |
网络通信接口--Windows Socket 及其应用. 李南方.武钢职工大学学报,第12卷第1期. 2000 * |
进程迁移中套接字迁移的研究与实现. 刘畅.重庆师范大学学报(自然科学版),第21卷第2期. 2004 |
进程迁移中套接字迁移的研究与实现. 刘畅.重庆师范大学学报(自然科学版),第21卷第2期. 2004 * |
Also Published As
Publication number | Publication date |
---|---|
CN1863091A (en) | 2006-11-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100568211C (en) | Realize method and the device of a plurality of I2C of visit with programming device from device | |
US7653738B2 (en) | Network management method, program, and system | |
US6516952B1 (en) | Dual mode serializer-deserializer for data networks | |
CN1909559B (en) | Interface board based on rapid periphery components interconnection and method for switching main-control board | |
TW200809521A (en) | Fault-isolating SAS expander | |
CN101645915B (en) | Disk array host channel daughter card, on-line switching system and switching method thereof | |
CN101710270B (en) | High-speed mass memory based on flash memory and chip data management method | |
JPS58147260A (en) | Communication system | |
CN102104936A (en) | Method for switching system states and portable terminal | |
JP2006072717A (en) | Disk subsystem | |
CN101009542B (en) | Extension device of data network node device port | |
CN100438438C (en) | Method for maintaining network entity interface state | |
JPH08507417A (en) | Controllable physical connection management state machine user interface | |
CN101488105B (en) | Method for implementing high availability of memory double-controller and memory double-controller system | |
CN102244589A (en) | Method and opposite terminal apparatus for processing link fault in virtual switch unit system | |
CN100586101C (en) | Switching between layer 2 switches as destination | |
CN109561032A (en) | A kind of switch module and the interchanger including it | |
CN101515255A (en) | Method and device for storing data | |
JP2010532540A (en) | Token protocol | |
CN100495982C (en) | Method and system for realizing fault switching in communications environments | |
WO2007028727A1 (en) | Facilitating detection of hardware service actions | |
CN100426722C (en) | Concatenation system | |
CN102495815B (en) | Processing method for I/O (input/output) data access interrupt, system and equipment | |
CN102393791B (en) | Device and method for realizing power supply control on hardware modules | |
CN101686119A (en) | Method, device and system of communication between single boards |
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 | ||
C17 | Cessation of patent right | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20081126 Termination date: 20130215 |