CN102045654B - Asynchronous socket communication method and mobile phone positioning system using same - Google Patents

Asynchronous socket communication method and mobile phone positioning system using same Download PDF

Info

Publication number
CN102045654B
CN102045654B CN200910196941.6A CN200910196941A CN102045654B CN 102045654 B CN102045654 B CN 102045654B CN 200910196941 A CN200910196941 A CN 200910196941A CN 102045654 B CN102045654 B CN 102045654B
Authority
CN
China
Prior art keywords
message
socket communication
messaging list
list
semaphore
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
CN200910196941.6A
Other languages
Chinese (zh)
Other versions
CN102045654A (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.)
Shanghai Zhongxing Yi Lian Link Communications Inc
Original Assignee
SHANGHAI ZTE COMMUNICATION TECHNOLOGY LLC
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 SHANGHAI ZTE COMMUNICATION TECHNOLOGY LLC filed Critical SHANGHAI ZTE COMMUNICATION TECHNOLOGY LLC
Priority to CN200910196941.6A priority Critical patent/CN102045654B/en
Publication of CN102045654A publication Critical patent/CN102045654A/en
Application granted granted Critical
Publication of CN102045654B publication Critical patent/CN102045654B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses an asynchronous socket communication method which comprises the following steps of: receiving a sent message by a receiving thread through an asynchronous socket; then, controlling the message list through semaphore; if the length of the message length does not reach the set maximum valve, then storing the message in the message list; if the length of the message length reaches the set maximum valve, locking the message list through the semaphore, taking the message out of the message list, sending, awakening the message list to continue receiving messages by the semaphore after sending, and taking the listed messages to be sent to a target node active module by a sending thread continuously. The message is stored in the message list by using the method, and the transmitted socket message can not be lost; all messages in the list are sent at a time, and the speed of transmission is quickened; the length of a queue is adjusted according to actual situation so as to ensure that a socket message queue can not be blocked under the situation of an unstable network; and the positioning function of a mobile phone positioning system using asynchronous socket communication can deal with the special situation of the unstable network on the basis of the above advantages.

Description

The mobile phone positioning system of asynchronous socket communication method and employing the method
Technical field
The present invention relates to the communications field, particularly relate to the mobile phone positioning system of asynchronous socket communication and application the method.
Background technology
The communication technology day different moon is new, particularly wireless communication technique, in the developing period that nowadays information industry is advanced by leaps and bounds, seems particularly important.And for the application of wireless communication technique, naturally also become the important directions of development in science and technology, wherein, it is present and even the important application of from now on one that wireless telecommunications are used for positioning.
Separately, along with the development of network communications technology, the application of socket communication is more and more extensive, how to ensure socket normal communication and data are not lost, how to ensure that communication is a very important problem in network concussion situation.
Adopt synchronous socket, can message blocking be caused when network condition is not so good, communication abnormality occurs; If do not add list, communication server module stops, and the message also do not sent will be lost; If messaging list is too little, and cause the full message blocking of list, thread is in wait for the arrival of news always and also can blocks.
In wireless location technology, because a lot of situation is all more special, such as network interruption, blocking etc., so the wireless location technology meeting special circumstances is particularly important.
In view of this, how the mobile phone positioning system of a kind of asynchronous socket communication method and employing the method is provided, reduces above-mentioned drawback and become industry technical problem urgently to be resolved hurrily.
Summary of the invention
An object of the present invention is to provide a kind of asynchronous socket communication method, transmission data integrity, and can not run off data; Accelerate communication transfer speed; Ensure that, when unstable networks, socket message queue can not block.
An object of the present invention is to provide a kind of mobile phone positioning system adopting asynchronous socket communication, can tackle network and occur unstable special status.
In order to achieve the above object, the invention provides a kind of asynchronous socket communication method, described method comprises: asynchronous socket by the message deposit that receives in messaging list; Control described messaging list length by semaphore, if messaging list length does not reach setting maximum, then continue receipt message; If messaging list length reaches setting maximum, then lock described information list by described semaphore, the message in messaging list is taken out and sends; And semaphore wakes described messaging list continuation receipt message up after sending.
Wherein, in a particular embodiment, described setting maximum is that the speed sent according to message sets, and ensures that, when unstable networks, socket message queue can not block.Employing group crossfire form sends the message content in messaging list, and described group of crossfire form is by the message composition character string in messaging list or code stream string.Described message is by disposable taking-up and send.Therefore, transfer rate can be accelerated.
In one embodiment, described method is also included in and receives and send message, needs to carry out information conversion according to smpp agreement.
A kind of mobile phone positioning system adopting asynchronous socket communication is provided, comprises: socket communication server, Service Processing Module, GIS server, sms center and mobile phone terminal.Wherein, described mobile phone terminal is connected by mobile radio network with described sms center, can receive geographical location information and show, and sends position enquiring information; Described GIS server provides geographical location information service; Described sms center is set up socket communication with described socket communication server and is connected, and forwards position enquiring information and geographical location information; Described Service Processing Module is connected by network with described GIS server, inquires about relevant geographical location information, and be transmitted to socket communication server according to position enquiring information in described GIS server; Described socket communication server between described sms center and described Service Processing Module, sets up socket communication respectively connect, information conversion is carried out according to information translation-protocol, by the message deposit that receives in messaging list, described messaging list length is controlled: if messaging list length does not reach setting maximum, then continue receipt message by semaphore; If messaging list length reaches setting maximum, then lock described information list by described semaphore, the message in messaging list taken out and send, after sending, semaphore wakes described messaging list continuation receipt message up.
In a particular embodiment, described agreement is smpp agreement, is the conversion that information needed for described Service Processing Module and sms center carries out decoding and encoding.Described setting maximum is that the speed sent according to message sets.Described socket communication server be employing group crossfire form to send the message content in messaging list, described group of crossfire form is by the message composition character string in messaging list or code stream string.Message is sent by disposable taking-up in described socket communication server.
The asynchronous socket communication method of one of the present invention, has the following advantages: message deposit is in information list, and the socket message of transmission can not be lost; The disposable transmission of all message in list, accelerates the speed transmitted; According to the size of actual conditions adjustment queue length, ensure that, when unstable networks, socket message queue can not block.A kind of mobile phone positioning system adopting asynchronous socket communication of the present invention, on the basis of above-mentioned advantage, its positioning function can be tackled network and occur unstable special status.
Accompanying drawing explanation
Fig. 1 is asynchronous socket communication method flow diagram of the present invention;
Fig. 2 is the mobile phone positioning system block diagram that the present invention adopts asynchronous socket communication;
Embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art can understand other advantages of the present invention and effect easily by content disclosed in the present specification.The present invention is also implemented by other different instantiations or is applied, and the every details in this specification also can based on different viewpoints and application, carries out various modification and change not deviating under object of the present invention.
One of the present invention asynchronous socket communication method is applied in asynchronous socket communication field.
Refer to Fig. 1, be display asynchronous socket communication method flow diagram of the present invention, as shown in the figure, the asynchronous socket communication method of one of the present embodiment comprises:
Step S11, the data that receiving thread is sent by another node of socket continuous reception or module;
Step S12, by the list of semaphore control message, judges whether messaging list length reaches setting maximum;
Step S13, if messaging list length does not reach setting maximum, then by the message deposit that receives in described messaging list, and then carry out step S11, namely receiving thread continues receipt message;
Step S14, if messaging list length reaches setting maximum, then locks described information list by semaphore;
Step S15, sends thread and the message in messaging list is taken out and be sent to destination node;
Step S16, after message sends, semaphore wakes described messaging list up, and continue receipt message, and carry out step S12, so circulate communication.
Wherein, in the present embodiment, described setting maximum is that the speed sent according to real messages sets, namely described setting maximum is variable, dynamic, such as, this setting maximum can be set according to the speed of the Nodes up and down receiving or send message, can ensure that, when unstable networks, socket message queue can not block like this.In addition, group crossfire form can also be adopted to send the message content in messaging list, described group of crossfire form is by the message composition character string in messaging list or code stream string, and described message is sent by disposable taking-up, therefore, message transmission speed can be accelerated like this.
In the present embodiment, described asynchronous socket communication method also comprises: when receiving and send message, need to carry out information conversion according to smpp agreement, namely after receiving bottom data, need the data first it being converted into upper strata needs by the decoding of smpp information translation-protocol, the same manner is changed in the other direction.
The asynchronous socket communication method of one of the present invention, has the following advantages: message deposit is in information list, and the socket message of transmission can not be lost; The disposable transmission of all message in list, accelerates the speed transmitted; According to the size of actual conditions adjustment queue length, ensure that, when unstable networks, socket message queue can not block.
Refer to Fig. 2, it is the mobile phone positioning system block diagram that display the present invention adopts asynchronous socket communication, as shown in the figure, the invention provides a kind of mobile phone positioning system adopting asynchronous socket communication, comprise: socket communication server 14, Service Processing Module 13, GIS server 11, sms center 12, and mobile phone terminal 10, wherein, described mobile phone terminal 10 is connected by mobile radio network with described sms center 12, can geographical location information be received and show, and send position enquiring information, namely major function is the message of reception sms center 12 transmission and sends message to sms center 12.Wherein, described mobile radio network can be GSM network or cdma network, or other communication network, public network or private network.
Described GIS (GIS-Geographic Information System, Geographic Information System) server 11 provides geographical location information service, the acquisition of such as geographic position data, storage, display, editor, process, analysis, the service such as output and application.
Described sms center 12 is set up socket communication with described socket communication server 14 and is connected, forward position enquiring information and geographical location information, namely described sms center 12 major function be receive socket communication server 14 information and sending to mobile phone terminal, and mobile phone is sent content and is transmitted to socket communication server 14.
Described Service Processing Module 13 is connected by network with described GIS server 11, inquires about relevant geographical location information, and be transmitted to socket communication server 14 according to position enquiring information in described GIS server 11.Namely the major function of described Service Processing Module 13 is the message warehouse-ins receiving socket communication server 14; The geographical location information searching user by described GIS server 11 sends to socket communication server 14; In addition, described Service Processing Module 13 can also send localization message to socket communication server by webpage.
Described socket communication server 14 between described sms center 12 and described Service Processing Module 13, sets up socket communication respectively connect, it is control described messaging list by semaphore that this socket communication connects: mainly judge whether messaging list length reaches setting maximum, if reach setting maximum, then lock described information list by described semaphore, after message being sent, semaphore wakes described messaging list continuation receipt message again up.
In the present embodiment, described agreement is smpp agreement, is the conversion that information needed for described Service Processing Module 13 and sms center 12 carries out decoding and encoding.Described setting maximum is that the speed sent according to message sets, such as, set this setting maximum according to the speed of the message sink in sms center 12 or Service Processing Module 13 and transmission.Described socket communication server 14 be employing group crossfire form to send the message content in messaging list, described group of crossfire form is by the message composition character string in messaging list or code stream string.Message is sent by disposable taking-up in described socket communication server 14.
In actual applications, the mobile phone positioning system of the asynchronous socket communication of whole employing is disposed in the following way: realize whole system, socket communication server 14 need be disposed, Service Processing Module 13, sms center 12, GIS server 11, socket communication server 14 set up socket long-chain with sms center 12 and Service Processing Module 13 and connect, message can be sent out mutually; Mobile phone terminal 10 can send out relocation command message or positional information to sms center 12, and sms center 12 sends to socket communication server 14; Service Processing Module 13 is according to the legitimacy of verification consumer positioning and show on map according to position enquiring information inquiry GIS server 11, or converts geographical location information to.
The step that the mobile phone positioning system of the asynchronous socket communication of whole employing runs can be, such as:
1, socket communication server 14 starts, and foundation is connected with Service Processing Module 13 and sms center 12 connects.
Sms center 12 is set up socket with socket communication server 14 and is connected, and starts a thread and detects heartbeat, and one sends thread, a receiving thread.
Socket communication server 14 opens listening port, sets up and is connected with Service Processing Module 13, starts one and sends thread and receiving thread.
2, mobile phone terminal 10 sends position requests or position enquiring information to after socket communication server 14 by sms center 12, and socket communication server 14 is deposited in message content in messaging list.
3, by semaphore control information list length, reach locking information list after maximum, send and follow-uply continue messaging list content.
4, carry out setup message list length according to message transmission speed, reach transmission speed and do not produce the equilibrium value of message blocking.
5, socket communication server 14 once takes out composition crossfire messaging list content and sends to Service Processing Module 13, accelerates message transmission speed.
6, Service Processing Module 13 enters database, carries out user validation verification or according to position enquiring information GIS server 11 inquiring user positional information.
7, Service Processing Module 13 sends to socket communication server 14 message, and socket communication server 14 utilizes socket that message is sent to sms center 12 according to step 2-5 again.
8, sms center 12 sends to mobile phone terminal 10 by wireless network, thus completes the function of mobile phone terminal location.
In sum, the asynchronous socket communication method of one of the present invention, locked and wakeup message queue by semaphore, can be two nodes or same node disparate modules between the socket communication of a large amount of interacting message, message deposit in messaging list, thread is got list message and is formed character string or the transmission of code stream string, when messaging list length arrives setting maximum, semaphore pins list, after sending message, semaphore wakes thread up and resumes operation, therefore, accelerate the speed of transfer of data, especially at network service less stable, time socket blocks, namely the loss of information is prevented, ensure that the smooth communication of socket.Adopt the mobile phone positioning system of asynchronous socket communication on above-mentioned advantage basis, mobile phone is located and can tackle the unstable special status of network appearance, be more applicable to the application under particular surroundings.
Above-mentioned is can understand for ease of those skilled in the art and use the present invention to the description of embodiment.Person skilled in the art obviously can make various amendment to these embodiments soon, and General Principle described herein is applied in other embodiments and need not through performing creative labour.Therefore, the invention is not restricted to embodiment here, those skilled in the art are according to announcement of the present invention, and the improvement made for the present invention and amendment all should within protection scope of the present invention.

Claims (7)

1. an asynchronous socket communication method, is characterized in that comprising step:
Receiving thread continuous reception message;
By the list of semaphore control message, if messaging list length does not reach setting maximum, then by the message deposit that receives in described messaging list; If messaging list length reaches setting maximum, then lock described messaging list by described semaphore, send thread and message is taken out and sends;
Send thread to continue the message in messaging list is taken out and sends; And semaphore wakes described messaging list continuation receipt message up after message transmission;
Described setting maximum is that the speed sent according to message sets, and described setting maximum is variable, and dynamically, the setting of described maximum sets according to the speed of the Nodes up and down accepting or send message.
2. asynchronous socket communication method according to claim 1, is characterized in that: employing group crossfire form is to send the message content in messaging list, and described group of crossfire form is by the message composition character string in messaging list or code stream string.
3. asynchronous socket communication method according to claim 1, is characterized in that: described message is by the transmission disposable taking-up of thread and sends.
4. asynchronous socket communication method according to claim 1, is characterized in that: when being also included in reception and sending message, need to carry out information conversion according to smpp agreement.
5. one kind adopts the mobile phone positioning system of asynchronous socket communication method according to claim 1, it is characterized in that comprising: socket communication server, Service Processing Module, GIS server, sms center and mobile phone terminal, wherein, described mobile phone terminal is connected by mobile radio network with described sms center, can geographical location information be received and show, and sending position enquiring information; Described GIS server provides geographical location information service; Described sms center is set up socket communication with described socket communication server and is connected, and forwards position enquiring information and geographical location information; Described Service Processing Module is connected by network with described GIS server, inquires about relevant geographical location information, and be transmitted to socket communication server according to position enquiring information in described GIS server; Described socket communication server is between described sms center and described Service Processing Module, set up the socket communication connection being controlled described messaging list by semaphore respectively;
The described socket communication connection being controlled described messaging list by semaphore, judge whether messaging list length reaches setting maximum, if reach setting maximum, then lock described information list by described semaphore, after message being sent, semaphore wakes described messaging list continuation receipt message again up;
Described setting maximum sets according to the speed of the Nodes up and down accepting or send message; Described socket communication server and described Service Processing Module, described sms center are set up socket length and are connected.
6. the mobile phone positioning system of the asynchronous socket communication method of employing according to claim 5, it is characterized in that: described socket communication connects employing smpp agreement, and the information needed for described Service Processing Module and sms center carries out the conversion of decoding and encoding.
7. the mobile phone positioning system of the asynchronous socket communication method of employing according to claim 5, it is characterized in that: described socket communication server is that employing group crossfire form is to send the message content in messaging list, described group of crossfire form is that disposable taking-up also sends by the message composition character string in messaging list or code stream string.
CN200910196941.6A 2009-10-10 2009-10-10 Asynchronous socket communication method and mobile phone positioning system using same Active CN102045654B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200910196941.6A CN102045654B (en) 2009-10-10 2009-10-10 Asynchronous socket communication method and mobile phone positioning system using same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200910196941.6A CN102045654B (en) 2009-10-10 2009-10-10 Asynchronous socket communication method and mobile phone positioning system using same

Publications (2)

Publication Number Publication Date
CN102045654A CN102045654A (en) 2011-05-04
CN102045654B true CN102045654B (en) 2015-01-28

Family

ID=43911326

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200910196941.6A Active CN102045654B (en) 2009-10-10 2009-10-10 Asynchronous socket communication method and mobile phone positioning system using same

Country Status (1)

Country Link
CN (1) CN102045654B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102355419A (en) * 2011-09-30 2012-02-15 南威软件股份有限公司 Ultra-large data switch engine
CN102938783A (en) * 2012-10-30 2013-02-20 中兴通讯股份有限公司 Socket processing method and device and Web server
CN106487945B (en) * 2016-09-09 2019-05-17 中国互联网络信息中心 A kind of DNS forwarding inquiries method
CN106412861B (en) * 2016-09-28 2017-11-28 海南港澳资讯产业股份有限公司 A kind of short message distribution method and system
CN107066342B (en) * 2017-04-24 2020-07-31 厦门黑镜科技有限公司 Information display method and device
CN108200544B (en) * 2018-03-02 2021-12-28 北京中电普华信息技术有限公司 Short message issuing method and short message platform
CN113347151B (en) * 2021-04-28 2023-04-28 厦门海迈科技股份有限公司 Data interaction method based on socket shared memory

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1585378A (en) * 2004-05-24 2005-02-23 中兴通讯股份有限公司 Processing method for exchanging system and continuous message
WO2005064960A1 (en) * 2003-12-29 2005-07-14 Zte Corporation A common path signal link system overload control method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005064960A1 (en) * 2003-12-29 2005-07-14 Zte Corporation A common path signal link system overload control method
CN1585378A (en) * 2004-05-24 2005-02-23 中兴通讯股份有限公司 Processing method for exchanging system and continuous message

Also Published As

Publication number Publication date
CN102045654A (en) 2011-05-04

Similar Documents

Publication Publication Date Title
CN102045654B (en) Asynchronous socket communication method and mobile phone positioning system using same
US10244500B2 (en) Open wireless architecture (OWA) mobile cloud infrastructure and method
US8233408B2 (en) Mobile cloud architecture based on open wireless architecture (OWA) platform
US5959543A (en) Two-way wireless messaging system with flexible messaging
CN113596191B (en) Data processing method, network element equipment and readable storage medium
CA2206218C (en) Two-way wireless cellular messaging system
US9084281B2 (en) Open wireless architecture (OWA) mobile cloud infrastructure and method
US5956331A (en) Integrated radio communication system
US20150229713A1 (en) Open wireless architecture (owa) mobile cloud infrastructure and method
US20150235329A1 (en) Classified relation networking optimization platform in open wireless architecture (owa) mobile cloud terminal device
CN101946556A (en) Aggregating portable base stations of femtocells
CN102291699A (en) Mobile phone short message sending system and method for combining IP (internet protocol) information and SMS (short message service) short message
CN104410982B (en) Terminal polymerization and reconstructing method in a kind of Wireless Heterogeneous Networks
CN113572864B (en) Data processing method, network element equipment and readable storage medium
CN113572835A (en) Data processing method, network element equipment and readable storage medium
US10200909B2 (en) Open wireless architecture (OWA) mobile cloud infrastructure and method
CN101631127A (en) File transfer method and clients
WO2010042351A1 (en) Supporting short burst messages over wireless communication networks
CN100456852C (en) Control system and control method for short message value-added service
US20100075700A1 (en) Flexible capacity short message service center (SMSC)
CN113261249A (en) Data transmission method, related equipment and computer storage medium
CN104135744A (en) Communication system and communication method related to communication system
CN101835109B (en) Business Initiator's method and terminal
CN101990178B (en) Equipment and system for processing short message of take-out user and method for processing short message service
JP2007300629A (en) Method and system for speeding up access from mobile terminal to contents

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
C56 Change in the name or address of the patentee
CP03 Change of name, title or address

Address after: 201203 Shanghai H hi tech park, Pudong, Zhongxing Road, No. 889, Zhongxing Telecom Building, block 6F

Patentee after: Shanghai ZTE Technologies Co., Ltd.

Address before: Pudong hi tech 200041 Bibo road Shanghai City No. 889

Patentee before: Shanghai ZTE Communication Technology Limited Liability Company

CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 201203 Zhangjiang High Tech Park, Pudong New Area, Shanghai 889

Patentee after: Shanghai Zhongxing Yi Lian Link Communications Inc

Address before: 201203 Pudong Zhangjiang hi tech park, Shanghai, 889 H, ZTE communication tower, block 6F

Patentee before: Shanghai ZTE Technologies Co., Ltd.