CN102664868A - Method of session protocol based on stream transmission - Google Patents

Method of session protocol based on stream transmission Download PDF

Info

Publication number
CN102664868A
CN102664868A CN2012100721608A CN201210072160A CN102664868A CN 102664868 A CN102664868 A CN 102664868A CN 2012100721608 A CN2012100721608 A CN 2012100721608A CN 201210072160 A CN201210072160 A CN 201210072160A CN 102664868 A CN102664868 A CN 102664868A
Authority
CN
China
Prior art keywords
terminal
information
bag
session
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2012100721608A
Other languages
Chinese (zh)
Inventor
张维
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fuzhou Rockchip Electronics Co Ltd
Original Assignee
Fuzhou Rockchip Electronics 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 Fuzhou Rockchip Electronics Co Ltd filed Critical Fuzhou Rockchip Electronics Co Ltd
Priority to CN2012100721608A priority Critical patent/CN102664868A/en
Publication of CN102664868A publication Critical patent/CN102664868A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention relates to a method of session protocol based on stream transmission. Based on the assumptions that an end point A is connected with an end point B through the stream transmission, and that the end point A sends a paragraph of characters to the end point B. the method comprises the following steps that an application layer of the end point A determines information to be transmitted; the end point A calls the sending command of a session layer, and the information is packed during the period; a packed information packet is transmitted to the end point B through a transport layer; a session layer of the end point B receives the information packet; the end point B analyses the information packet; and the end point B transmits the analyzed information to an application layer of the end point B, and restores information. The method provides an own session protocol on the transmission layer for the use by the application layer, thereby simplifying the exploitation of the application layer and enabling the system to have stronger extensible capability.

Description

A kind of method of the session protocol based on flow transmission
[technical field]
The present invention relates to network communications technology, specifically be meant a kind of method of the session protocol based on flow transmission.
[background technology]
Cross over distinct device, it is important that the communication of different system has more and more seemed.One reliable, simple, do not rely on the communication pattern of underlying protocol restriction, can let the development efficiency of cross-platform communication and operational efficiency all promote.
At present, the transfer of data general work is in TCP, UDP; Or on other agreement; But these agreements only provide transmission Data Base this method, further do not guarantee to connect and the more senior API that transmits data, and these all are to need carry out the encapsulation on the agreement again to specific field.
When communicating between main frame, usually be a kind of transmission means of streaming, like the Transmission Control Protocol of TCP/IP; Like the transmission of USB, the transmission of serial ports, but these transmission meanss are only supplied with the passage of a stream transmission; Not to the framework of our session and expression; So, oneself session protocol need be provided on transport layer, use for our application layer.Take out the session layer of oneself, can simplify the exploitation of application layer, also can be so that system has stronger expandability.
In view of this, the inventor furthers investigate to the defective of prior art, and has this case to produce.
[summary of the invention]
Technical problem to be solved by this invention is to provide a kind of method of the session protocol based on flow transmission; It is the session protocol that oneself is provided on transport layer; Use for application layer, can simplify the exploitation of application layer like this, also can be so that system has stronger expandability.
The present invention adopts following technical scheme to solve the problems of the technologies described above:
A kind of method of the session protocol based on flow transmission is established terminal A and is connected through stream transmission with terminal B, and terminal A will send to terminal B to passage szMessage, comprise the steps:
Step 1: the definite information that will send of the application layer of terminal A is packaged into a packets of information to szMessage according to corresponding format;
Packet infrastructure: a bag comprises 5 parts, i.e. information header+metadata+additional data+data volume+information tail;
Metadata comprises session id, bag ID, data type, data volume length, growth data length, identifying code, coded system;
Growth data is some additional informations, or supplementary;
Data volume is the part that comprises flesh and blood, as, common language, document flow, video flowing;
Step 2: terminal A sends packets of information to terminal B, use be that the stream transmission of bottom is sent;
Step 3: terminal B receives data flow;
Step 4: terminal B confirms that by corresponding format inspection data flow this is a packets of information; Each bag all has packet header and bag tail, confirms that a packets of information must have 2 condition: a, comprise packet header and bag tail; The length of b, bag has statement in metadata; If do not meet above two conditions, explanation is a rascal; When receiving data,, then be placed on data in the buffering area if confiscate complete bag;
Step 5: behind the terminal B confirmation bag, extract session id in the metadata, set up a new session;
Step 6: terminal B obtains szMessage from packets of information;
Step 7: afterwards, terminal A can use same session id constantly to communicate by letter with terminal B, repeating step one-step 6; Send when terminal A or terminal B and to stop request, or overtime, then conversation.
The overtime method that is judged as conversation comprises in the said step 7: transmission heartbeat packet regularly if do not receive heartbeat packet within a certain period of time, then is regarded as conversation.
The invention has the advantages that: 1, can not rely on specific bottom host-host protocol; 2, can with the disconnection that is connected automatic notice be arranged for the success of message; 3, can transmit the polytype data; 4, be applicable to kinds of platform, irrelevant with the operating system programming language.
[description of drawings]
Combine embodiment that the present invention is done further description with reference to the accompanying drawings.
Fig. 1 is a flow chart of the present invention.
Fig. 2 is packet infrastructure figure among the present invention.
[embodiment]
As shown in Figure 1, a kind of method of the session protocol based on flow transmission is established terminal A and is connected through stream transmission with terminal B, and terminal A will send to terminal B to passage szMessage, comprise the steps:
Step 1: the definite information that will send of the application layer of terminal A is packaged into a packets of information to szMessage according to corresponding format;
Packet infrastructure: as shown in the table, a bag comprises 5 parts, i.e. information header+metadata+additional data+data volume+information tail;
Metadata comprises session id, bag ID, data type, data volume length, growth data length, identifying code, coded system;
Growth data generally speaking, is only the thing that the recipient really wants in the data volume, growth data is some additional informations, or supplementary; Such as file of transmission, in the data volume content of file, growth data is the name of include file then, length, the information of size and so on;
Data volume is the part that comprises flesh and blood, as, common language, document flow, video flowing;
The classification of packets of information is unlimited the kind, does self-defined according to application layer.Use following several kinds but can give tacit consent to:
The order bag: transmission control, as, inform that the other side closes connection, or other explosion command;
Text packets: plain text, can come encoding and decoding according to the coded system of metadata;
The file bag: file can be the file of segmentation;
Primary flow bag: original streams such as video flowing or audio stream;
Heartbeat packet: inform to connect to be in normal condition;
Confirm bag: inform that message is successfully received;
One is sent the literal example, as sending hello
<<<<<text******5*********0*********utf8******xxxxxxxxxxhello>>>>>
An example that sends file is content like the file content
<<<<<file******7*********13*********utf8******xxxxxxxxxxname=tes?t.txtcontent>>>>>
Step 2: terminal A is called the transmission order of session layer, sends packets of information to terminal B, use be that the stream transmission of bottom is sent;
Step 3: the session layer of terminal B receives data flow;
Step 4: terminal B confirms that by corresponding format inspection data flow this is a packets of information; Each bag all has packet header and bag tail, confirms that a packets of information must have 2 condition: a, comprise packet header and bag tail; The length of b, bag has statement in metadata; If do not meet above two conditions, explanation is a rascal; When receiving data,, then be placed on data in the buffering area if confiscate complete bag;
Step 5: behind the terminal B confirmation bag, extract session id in the metadata, set up a new session;
Step 6: the information that terminal B is resolved quilt is passed to the application layer of terminal B, and terminal B obtains szMessage from packets of information;
Step 7: afterwards, terminal A can use same session id constantly to communicate by letter with terminal B, repeating step one-step 6; Send when terminal A or terminal B and to stop request, or overtime, then conversation.
Confirm that the mode that a connection is disconnected is: transmission heartbeat packet regularly, if do not receive heartbeat packet within a certain period of time, then be regarded as connection and be disconnected, possibly be software, also possibly be the reason of hardware, this is a solution commonly used in the homogeneous system.
Because software or hardware reason, TCP connects and has broken off in time-out time, still, connects as long as rebulid TCP, uses same session id when terminal A and terminal B, and that is just still in same conversation procedure.
Among the present invention, begin to transmit data as long as have, session has just been set up; All must comprise session id in each packet; As long as the session id of the bag of receiving is same, these bags all belong to same session so; As, a TCP connects, and a plurality of sessions can be arranged, and a plurality of TCP connect, and possibly all belong to a session; Unique ID of definite use of session, during transmits data packets, each bag all must comprise session id; In same TCP connects, can use different session ids, to represent different conversation procedures.
In same TCP connected, different words session ids can be not in order, as, five transmission of messages, can be respectively, session 1, session 2, session 1, session 3, session 1, therefore, session connection is incoherent with the physics or being connected of software of bottom.
A complete bag is received in assurance: each bag all has packet header and bag tail, confirms that a bag must have 2 conditions; 1, comprises packet header and bag tail; 2, the length of bag has statement in free of data, if do not meet, explanation is a rascal; When receiving data,, then be placed on data in the buffering area if confiscate complete bag;
Among the present invention, application layer is communicated by letter with session layer, based on the pattern of event notice; As when new session at first, when one complete when encapsulating parsing; At this time; Have and send successfully, or receive successful notice, when the other side does not have response, when unusual generation the time, after these incidents generations; What be transferred to application layer is more concrete information, rather than packets of information.
The bottom condition that method relied on of session protocol of the present invention must be based on a kind of streaming bottom transmission channel, like the transmission of USB, and the transmission of serial ports, the TCP transmission mode of TCP/IP; The base unit of transfer of data is based on the packet of byte stream, and each is surrounded by session id, bag ID, and other part, and the size of bag is not fixed, and a bag can transmit several times, and the content that once receives also possibly be a plurality of bags.
Message structure to bag can be expanded: at first, the length of bag can be expanded, and one is surrounded by the fixed length part, also has random length part (expansion area) that the size of statement expansion area is arranged in metadata; The order and the content of the transmission information of bag are carried out self-defined processing according to application layer fully.
The present invention has following beneficial effect: 1, can not rely on specific bottom host-host protocol; 2, can with the disconnection that is connected automatic notice be arranged for the success of message; 3, can transmit the polytype data; 4, be applicable to kinds of platform, irrelevant with the operating system programming language.
The above is merely preferable enforcement use-case of the present invention, is not to be used to limit protection model figure of the present invention.All within spirit of the present invention and principle, any modification of being done, be equal to replacement and improvement etc., all should be included within protection scope of the present invention.

Claims (2)

1. the method based on the session protocol of flow transmission is established terminal A and is connected through stream transmission with terminal B, and terminal A will send to terminal B to passage szMessage, comprise the steps:
Step 1: the definite information that will send of the application layer of terminal A is packaged into a packets of information to szMessage according to corresponding format;
Packet infrastructure: a bag comprises 5 parts, i.e. information header+metadata+additional data+data volume+information tail;
Metadata comprises session id, bag ID, data type, data volume length, growth data length, identifying code, coded system;
Growth data is some additional informations, or supplementary;
Data volume is the part that comprises flesh and blood;
Step 2: terminal A sends packets of information to terminal B, use be that the stream transmission of bottom is sent;
Step 3: terminal B receives data flow;
Step 4: terminal B confirms that by corresponding format inspection data flow this is a packets of information; Each bag all has packet header and bag tail, confirms that a packets of information must have 2 condition: a, comprise packet header and bag tail; The length of b, bag has statement in metadata; If do not meet above two conditions, explanation is a rascal; When receiving data,, then be placed on data in the buffering area if confiscate complete bag;
Step 5: behind the terminal B confirmation bag, extract session id in the metadata, set up a new session;
Step 6: terminal B obtains szMessage from packets of information;
Step 7: afterwards, terminal A can use same session id constantly to communicate by letter with terminal B, repeating step one-step 6; Send when terminal A or terminal B and to stop request, or overtime, then conversation.
2. the method for a kind of session protocol based on flow transmission as claimed in claim 1; It is characterized in that: the overtime method that is judged as conversation comprises in the said step 7: transmission heartbeat packet regularly; If do not receive heartbeat packet within a certain period of time, then be regarded as conversation.
CN2012100721608A 2012-03-16 2012-03-16 Method of session protocol based on stream transmission Pending CN102664868A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012100721608A CN102664868A (en) 2012-03-16 2012-03-16 Method of session protocol based on stream transmission

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012100721608A CN102664868A (en) 2012-03-16 2012-03-16 Method of session protocol based on stream transmission

Publications (1)

Publication Number Publication Date
CN102664868A true CN102664868A (en) 2012-09-12

Family

ID=46774279

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012100721608A Pending CN102664868A (en) 2012-03-16 2012-03-16 Method of session protocol based on stream transmission

Country Status (1)

Country Link
CN (1) CN102664868A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104917732A (en) * 2014-03-13 2015-09-16 深圳市赛格导航科技股份有限公司 Method of binding encoders and decoders with multiple clients and system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998051053A1 (en) * 1997-05-06 1998-11-12 Intermec Technologies Corporation Providing reliable communication over an unreliable transport layer in a hand-held device using a persistent session
CN1588914A (en) * 2004-08-05 2005-03-02 北京航空航天大学 Method for transmitting realtime multimedia data on internet
CN102075737A (en) * 2011-03-01 2011-05-25 天津市天祥世联网络科技有限公司 Video monitoring conversation method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1998051053A1 (en) * 1997-05-06 1998-11-12 Intermec Technologies Corporation Providing reliable communication over an unreliable transport layer in a hand-held device using a persistent session
CN1588914A (en) * 2004-08-05 2005-03-02 北京航空航天大学 Method for transmitting realtime multimedia data on internet
CN102075737A (en) * 2011-03-01 2011-05-25 天津市天祥世联网络科技有限公司 Video monitoring conversation method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104917732A (en) * 2014-03-13 2015-09-16 深圳市赛格导航科技股份有限公司 Method of binding encoders and decoders with multiple clients and system
CN104917732B (en) * 2014-03-13 2018-07-20 深圳市赛格导航科技股份有限公司 A kind of multi-client binds the method and system of encoder and decoder

Similar Documents

Publication Publication Date Title
CN101317404B (en) Method and system for transmitting and negotiating band width economization ability by IP packet, and method and system for economizing network band width
US9832681B2 (en) Higher layer compression with lower layer signaling
EP2509344B1 (en) Method for transmitting and receiving multimedia information and terminal thereof
EP1780918A1 (en) Method and system for providing clock synchronization over packet network
CN102088460B (en) Method, device and system for transmitting streaming media data in restricted networks
KR20060054662A (en) Apparatus and method for compressing of herder in a broad band wireless communication system
CN113055539B (en) Communication system based on VoIP dual-redundancy exchange server
WO2017092389A1 (en) Packet processing method and device
CN113225123B (en) Method for converting circuit voice to VOIP voice in satellite mobile communication system
CN102025727B (en) Integrated pushing system and method for collecting and accessing multiple application systems
CN111263317A (en) Broadcast data transmission method and device
CN102255906A (en) Data transmission and receiving methods, equipment and systems
JP4988039B2 (en) Apparatus and associated method for configuring an IMS service for use in a circuit switched device
CN105897665B (en) Method for realizing TCP transmission in satellite network environment and corresponding gateway
CN101883329B (en) Method and device for supporting MBMS (Multimedia Broadcast Multicast Service) business content synchronization based on integrated EPS (Evolved Packet System)
CN104427551A (en) A business message transmitting method and apparatus
CN102664868A (en) Method of session protocol based on stream transmission
CN107517202B (en) Binary sending and receiving method of SIP signaling
CN101197825A (en) Method, system and device for compression message transmission
CN206226468U (en) Based on the instant communicating system that websocket is realized
CN101404606B (en) Packet tunnel packaging structure and network tunnel management method
CN102801639B (en) Communication device and method for transmitting network management protocol by using E1 odd frame Sa bit
CN101146065B (en) A method for realizing dual-path dialing of remote gateway device
US10298521B2 (en) Systems and methods for connecting legacy products via an analog telephone adapter (ATA)
CN100375479C (en) Network system and method for implementing media gateway control protocol stack

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20120912