CN102624651A - Gateway communication method and device - Google Patents

Gateway communication method and device Download PDF

Info

Publication number
CN102624651A
CN102624651A CN201210060325XA CN201210060325A CN102624651A CN 102624651 A CN102624651 A CN 102624651A CN 201210060325X A CN201210060325X A CN 201210060325XA CN 201210060325 A CN201210060325 A CN 201210060325A CN 102624651 A CN102624651 A CN 102624651A
Authority
CN
China
Prior art keywords
data
gateway
function
socket
destination address
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
CN201210060325XA
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.)
BEIJING DIGITAL CHINA SI-TECH INFORMATION TECHNOLOGY Co Ltd
Original Assignee
BEIJING DIGITAL CHINA SI-TECH INFORMATION 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 BEIJING DIGITAL CHINA SI-TECH INFORMATION TECHNOLOGY Co Ltd filed Critical BEIJING DIGITAL CHINA SI-TECH INFORMATION TECHNOLOGY Co Ltd
Priority to CN201210060325XA priority Critical patent/CN102624651A/en
Publication of CN102624651A publication Critical patent/CN102624651A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the invention discloses a network communication method and a network communication device. A user datagram protocol (UDP) buffer is used for realizing the data transmission of a gateway to a peripheral system and the reception of data returned by the peripheral system. By the method, the limitation of requirements on the number and sizes of message queues in process communication can be avoided, so that the consumption of system resources can be reduced, the safety performance of the system can be improved, and data transmission efficiency can be improved.

Description

Gateway communication method and device
Technical field
The present invention relates to a kind of gateway communication method and device, particularly a kind of communication means and device between letter gateway and intercommunication gateway system process that is applied in the mobile communication technology field.
Background technology
In the gateway communication technology; Gateway and peripheral system SP (ServiceProvider, service provider), SMSC (Short Message Service Center, SMS service center) and other SMG (Short Message Gateway; Short messaging gateway) etc. all be towards connecting (TCP (Transmission Control Prot ocol; Transmission control protocol)/IP (Internet Protocol, IP(Internet Protocol))) communication mode, with the correctness that has guaranteed that information is transmitted.But in order to realize the communication mode of TCP/IP, need to use message queue and shared drive, to guarantee connection.It specifically stores the data that pass over through message queue, and writes the reply data that sends to the other side and reply row, in addition, also need be written to shared drive to some shared configuration informations of system and visit for other process.Like this, create some message queues and shared drive through regular meeting in the system, connect for communication and use.Shown in accompanying drawing 1.
But no matter be the message queue or the communication mode of shared drive, all have defective.Particularly, the quantity of message queue receives main frame restriction with size, and shared drive take Installed System Memory can not be too big, if influence the performance of system after too big.
And under HP-UX (the Hewlett Packard UniX) environment, because resource limit, message queue quantity, size all can be restricted.If the quantity of message queue or size are not enough, not only can reduce systematic function, possibly also can lead to system abnormity when serious.Therefore, need a kind of other communication mode,, improve the performance of system, and guarantee the reliability of communication to overcome the defective of above-mentioned communication mode.
Summary of the invention
The object of the invention is just in order to provide a kind of gateway communication method and device; Avoid when process communication, receiving the restriction of message queue quantity, size requirements; Thereby reduce the consumption of system resource, improve the security performance of system, and promote the efficiency of transmission of data.
On the one hand, the embodiment of the invention provides a kind of gateway communication method, and this gateway communication method may further comprise the steps:
Step (1): open the user datagram protocol UDP socket that is connected that is used to set up between gateway and the peripheral system;
Step (2): the destination address that specific data sends, set up being connected between gateway and the peripheral system;
Step (3): said gateway sends data to the UDP buffer, and said data send to destination address through said UDP buffer, and are received by said peripheral system;
Step (4): said gateway receives the return data of said destination address, and is saved in the local address that connects;
Step (5): whether the judgment data transmission finishes, if get into step (6), if not, then return step (3);
Step (6): break off the said socket that has connected.
On the other hand, the embodiment of the invention provides a kind of gateway communication device, and this gateway communication device comprises:
Be used to open the device that is used to set up the user datagram protocol UDP socket that is connected between gateway and the peripheral system;
Be used in reference to the destination address that given data is sent, and set up the device that is connected between gateway and the peripheral system;
Be used for sending to the UDP buffer device of data, said data send to destination address through said UDP buffer, and are received by said peripheral system;
Be used to receive the return data of said destination address, and be saved in the device of the local address that connects;
Be used for the judgment data transmission and whether finish, if, carry out to connect and break off module, if not, then proceed the device of transfer of data;
Be used to break off the device of the socket that has connected.
Gateway communication method provided by the invention and device can avoid when process communication, receiving the restriction of message queue quantity, size requirements, thereby reduce the consumption of system resource, improve the security performance of system, and promote the efficiency of transmission of data.
Description of drawings
Fig. 1 uses the communication mode exemplary plot of message queue and shared drive for prior art.
Fig. 2 is a communication means flow chart of the present invention.
Fig. 3 uses the communication mode exemplary plot of UDP buffer for the present invention.
Embodiment
Be example with handling process below, specify the steps flow chart of communication means at letter gateway MO (short message transmit telephone bill).
In the MO treatment progress, like the smpp_ICP process, the peripheral system that send to the information of receiving from sms center: SP (service provider) or SPMS (COS has the spare parts management service).During communication; Adopt long the connection between gateway and the peripheral systems such as SP, SPMS; Pass through User Datagram Protocol (User Datagram Protocol between smpp_ICP process and the other side's process (as: slsSndD process); Being called for short " UDP ") mode carries out interprocess communication: as client, the slsSndD process receives the message of UDP formation as service end, sends to corresponding peripheral system to message by the slsSndD process again by smpp_ICP.
After the common customer end is opened socket, use socket----->sendto ()/recvfrom to send data usually, and Home Network pass system adopts be UDP connection mode socket----->connect ()----->send/recv sends data.
Function definition is following:
int?send(int?s,const?void?*msg,size_t?len,int?flags);
int?send?to(int?s,const?void?*msg,size_t?len,int?flags,const?struct?sockaddr?*to,socklen_t?tolen);
int?recv(int?s,void?*buf,size_t?len,int?flags);
int?recvfrom(int?s,void?*buf,size_t?len,int?flags,struct?sockaddr?*from,socklen_t?*fromlen);
Can find out from function definition: sendto and recvfrom be assigned address when transmitting-receiving; Send and recv then do not have; Use function int connect (int sockfd for this reason; Const struct sockaddr * serv_addr, socklen_taddr len), specify the destination address of transmission through the connect function.Like this, whether kernel just inspection exists the mistake that can know immediately, and the IP address and the port numbers (taking from the socket addresses structure that passes to connect) of record opposite end turn back to calling process then immediately.For connecting the UDP socket, compare with the default socket that is not connected, following variation has taken place:
(1) do not use sendto and use send or write; Mean when noting be used in each transmission and all specify host IP and port numbers, all send to protocol address (for example IP address and port numbers) automatically by the connect appointment and write writes any content that connects on the UDP socket.
(2) obtain data through read or recv; Can connect at one and only receive those packets on the UDP socket from the specified protocol address of connect; And needn't use recvfrom to learn the sender of datagram; The destination of Data Receiving has been for this has connected the native protocol address of UDP socket, and the packet of the data protocol address that not to be the previous connect of this socket arrive with sending just can not be delivered to this socket.So just limited one connected the UDP socket and also only can with an opposite end exchange data packets.
(3) when appearance is unusual, the asynchronous mistake that is caused by the UDP socket that has connected returns to the process that their belong to.
Concrete communication steps is following:
(1): open the UDP socket that is connected that is used to set up between gateway and the peripheral system, can use the socket socket.
(2): the destination address that specific data sends, set up being connected between gateway and the peripheral system, promptly use connect to connect.
(3): gateway sends data to the UDP buffer, and data send to destination address through the UDP buffer, are received by peripheral system; At this moment; The data of using send or write to write buffer all can send to peripheral system, are received by peripheral system, shown in accompanying drawing 3.
(4): the return data of receiving target address, and be saved in the local address that connects, gateway receives the data from peripheral system through recv or read, and is kept at this locality.
(5): whether the judgment data transmission finishes, if get into step (6), if not, then return step (3);
(6): break off the socket that has connected, connect, be set to AF_UNSPEC to the address of socket addresses structure bunch member (sin_family) when calling connect once more in order to break off a UDP socket that has connected connect.What make socket disconnection connection is the process of calling connect on the UDP socket connecting.
During concrete the realization, in the smpp_ICP process, realize transmission through UDP technology completion client data by int sgip_longsnd (int cmd, int dstid, char * sndbuf, int len, char * rcvbuf) function.In concrete communication process, call api function by operation layer, submit message through UDP to communication process (slsSndD), communication process is through message queue echo reply message.The concrete definition of this api function is following:
int?sgip_longsnd(int?cmd,int?dstid,char?*sndbuf,int?len,char*rcvbuf)
Input parameter:
Cmd: send the ID of message, i.e. the command_ID of SGIP (Short Message Gateway Interface Protocol, Short message Gateway Interface Protocol) message
Dstid: the order ground node code of message
Sndbuf: the SGIP message of transmission, PDU form
The len:sndbuf message-length
Output parameter:
Rcvbuf: response message, PDU (Protocol Data Unit, protocol Data Unit) form
Return value: message is sent result, the Result of corresponding response packet
The client part example code
Figure BDA0000141767010000071
Server end partial code example
Figure BDA0000141767010000081
The beneficial effect that the present invention obtained is: 1) selected after the opposite end through connect, kernel only can be passed to socket with the opposite end data sent bag of bound object, has therefore promoted the fail safe of system; 2) if unusually, can return asynchronous mistake.Do not start if the opposite end, the ICMP retroeflection bag that the bag that sends under the default situations is corresponding can't be given calling process, through using connect, is returned to the process at their place by the asynchronous mistake of the UDP socket initiation that has connected; 3) do not need to break off again earlier between two packets of transmission to connect, promoted efficiency of transmission.
To announcement of the present invention,, do not break away from guidance of the present invention and scope according to above-mentioned, the present invention is made various changes and variation is obviously for those skilled in the art.Therefore, the present invention attempts to be included in various variations and the hardware in the equivalence techniques scope of the present invention, the change of software, and embodiment provided by the invention can realize through hardware, software.
Above-described embodiment; The object of the invention, technical scheme and beneficial effect have been carried out further explain, and institute it should be understood that the above is merely embodiment of the present invention; And be not used in qualification protection scope of the present invention; All within spirit of the present invention and principle, any modification of being made, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (14)

1. a gateway communication method is characterized in that, this gateway communication method may further comprise the steps:
Step (1): open the user datagram protocol UDP socket that is connected that is used to set up between gateway and the peripheral system;
Step (2): the destination address that specific data sends, set up being connected between gateway and the peripheral system;
Step (3): said gateway sends data to the UDP buffer, and said data send to destination address through said UDP buffer, and are received by said peripheral system;
Step (4): said gateway receives the return data of said destination address, and is saved in the local address that connects;
Step (5): whether the judgment data transmission finishes, if get into step (6), if not, then return step (3);
Step (6): break off the said socket that has connected.
2. gateway communication method as claimed in claim 1 is characterized in that, the return data of said destination address turns back to said local address through said UDP buffer.
3. gateway communication method as claimed in claim 1 is characterized in that, gateway process is through calling socket socket programming function to carry out the transmission of data.
4. like claim 2 or 3 described gateway communication methods, it is characterized in that gateway process calls and connects the destination address that connect function specific data sends and set up being connected between said gateway and the said peripheral system.
5. like claim 2 or 3 described gateway communication methods, it is characterized in that gateway process calls and connects connect function disconnection connection.
6. like claim 2 or 3 described gateway communication methods, it is characterized in that gateway process calls to be write the write function or send send function transmission data, the receiving terminal process transfer is read the read function or receives the recv function to receive data.
7. like claim 2 or 3 described gateway communication methods, it is characterized in that gateway process calls to be read the read function or receive the recv function to receive data.
8. a gateway communication device is characterized in that, this gateway communication device comprises:
Be used to open the device that is used to set up the user datagram protocol UDP socket that is connected between gateway and the peripheral system;
Be used in reference to the destination address that given data is sent, and set up the device that is connected between gateway and the peripheral system;
Be used for sending to the UDP buffer device of data, said data send to destination address through said UDP buffer, and are received by said peripheral system;
Be used to receive the return data of said destination address, and be saved in the device of the local address that connects;
Be used for the judgment data transmission and whether finish, if, will connect disconnection, if not, then proceed the device of transfer of data;
Be used to break off the device of the socket that has connected.
9. gateway communication device as claimed in claim 8 is characterized in that, also comprises, is used to receive the device of return data that turns back to the said destination address of local address through said UDP buffer.
10. gateway communication device as claimed in claim 8 is characterized in that, also comprises, is used for through calling the device of socket socket programming function with the transmission of execution data.
11., it is characterized in that like claim 8 or 9 described gateway communication devices, also comprise, be used for connecting the destination address that connect function specific data sends and setting up the device that is connected between said gateway and the said peripheral system through calling.
12., it is characterized in that like claim 8 or 9 described gateway communication devices, also comprise, be used to call the device that connects connect function disconnection connection.
13., it is characterized in that like claim 8 or 9 described gateway communication devices, also comprise, be used for writing the write function or sending the device that the send function sends data through calling;
Be used for calling the device of reading the read function or receiving recv function reception data at receiving terminal.
14., it is characterized in that like claim 8 or 9 described gateway communication devices, also comprise, be used for reading the read function or receiving the device that the recv function receives data through calling.
CN201210060325XA 2012-03-08 2012-03-08 Gateway communication method and device Pending CN102624651A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210060325XA CN102624651A (en) 2012-03-08 2012-03-08 Gateway communication method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210060325XA CN102624651A (en) 2012-03-08 2012-03-08 Gateway communication method and device

Publications (1)

Publication Number Publication Date
CN102624651A true CN102624651A (en) 2012-08-01

Family

ID=46564341

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210060325XA Pending CN102624651A (en) 2012-03-08 2012-03-08 Gateway communication method and device

Country Status (1)

Country Link
CN (1) CN102624651A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105553977A (en) * 2015-12-15 2016-05-04 网易(杭州)网络有限公司 Request message processing and transmitting method and device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101946491A (en) * 2008-02-29 2011-01-12 汤姆逊许可公司 Methods and apparatuses for providing load balanced signal distribution

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101946491A (en) * 2008-02-29 2011-01-12 汤姆逊许可公司 Methods and apparatuses for providing load balanced signal distribution

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
W.RICHARD STEVENS: "《UNIX网络编程(第1卷)》", 30 September 2001, 清华大学出版社 *
刘玻,等: "应用已连接套接字控制VoIP系统QoS", 《2006中国控制与决策学术年会论文集》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105553977A (en) * 2015-12-15 2016-05-04 网易(杭州)网络有限公司 Request message processing and transmitting method and device
CN105553977B (en) * 2015-12-15 2019-05-24 网易(杭州)网络有限公司 Processing, sending method and the device of request message

Similar Documents

Publication Publication Date Title
TWI332150B (en) Processing data for a tcp connection using an offload unit
KR101941416B1 (en) Networking Technologies
CN101997673B (en) Network agent implementation method and device
US20090241180A1 (en) System and Method for Data Transport
US9015822B2 (en) Automatic invocation of DTN bundle protocol
EP3361389B1 (en) Tcp processing for devices
US8886234B2 (en) Techniques for unified messaging
CN107360177B (en) A kind of message transmitting method and device based on UDP
CN102111419A (en) Message middleware-based client automatic reconnection method
CN105491169A (en) Data proxy method and system
CN103795632A (en) Data message transmission method, related equipment and system
US8825804B2 (en) Method and system for avoiding an unintentional time-out for communications in a client-proxy-server environment
CN105610852A (en) Method and device for processing ACK (Acknowledgement) flooding attack
WO2014036949A1 (en) Method and system for mail processing
CN102761534A (en) Method and device for realizing transparent proxy of media access control layer
CN103414730A (en) Method and device for processing ARP messages
CN105141603A (en) Communication data transmission method and system
US8885653B2 (en) Protocol translation
JP2014123363A5 (en)
CN110247926A (en) A kind of exchange method and system
CN107666430B (en) E-mail sending method, device and terminal
CN102571636A (en) Message communication method and system based on open service delivery platform
CN102624651A (en) Gateway communication method and device
CN108966319B (en) Data packet transmission control method, mobile terminal and device
CN105721491B (en) A kind of communication means for being emulated towards high speed Maglev

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent of invention or patent application
CB02 Change of applicant information

Address after: 100085 Haidian District, Zhongguancun, South Street, No. 6,, building information, floor, No. 16

Applicant after: SI-TECH Information Technology Ltd.

Address before: 100085 Haidian District, Zhongguancun, South Street, No. 6,, building information, floor, No. 16

Applicant before: Beijing Digital China SI-TECH Information Technology Co., Ltd.

COR Change of bibliographic data

Free format text: CORRECT: APPLICANT; FROM: BEIJING DIGITAL CHINA SI-TECH INFORMATION TECHNOLOGY LTD. TO: BEIJING SI-TECH INFORMATION TECHNOLOGY LTD.

C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20120801