CN102045654A - 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
CN102045654A
CN102045654A CN2009101969416A CN200910196941A CN102045654A CN 102045654 A CN102045654 A CN 102045654A CN 2009101969416 A CN2009101969416 A CN 2009101969416A CN 200910196941 A CN200910196941 A CN 200910196941A CN 102045654 A CN102045654 A CN 102045654A
Authority
CN
China
Prior art keywords
message
socket
messaging list
socket communication
mobile phone
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.)
Granted
Application number
CN2009101969416A
Other languages
Chinese (zh)
Other versions
CN102045654B (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

Images

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 asynchronous socket means of communication and adopt the mobile phone positioning system of this method
Technical field
The present invention relates to the communications field, relate in particular to asynchronous socket communication and use the mobile phone positioning system of this method.
Background technology
Communication technology day is different month new, and wireless communication technique particularly, seems particularly important at the developing period in that nowadays information industry is advanced by leaps and bounds.And, also become the important directions of development in science and technology naturally for the application of wireless communication technique, wherein, it is now and even an important use from now on that wireless telecommunications are used for positioning.
In addition, along with the development of network communications technology, how the application of socket communication more and more widely guarantees the socket normal communication and data are not lost, and how to guarantee that under network concussion situation communication is a very important problem.
Adopt synchronous socket, can cause that under the not so good situation of network condition message blocks, communication abnormality takes place; If do not add tabulation, the communication server module stops, and the message that does not also have to send will be lost; If messaging list is too little, and the full message that causes tabulating is blocked, and thread is in to wait for the arrival of news always and also can blocks.
In wireless location technology, because a lot of situation is all more special, for example network interruption, obstruction etc. are so the wireless location technology that satisfies special circumstances is particularly important.
In view of this, how a kind of asynchronous socket means of communication are provided and adopt the mobile phone positioning system of this method, reduce above-mentioned drawback and become the technical problem that industry needs to be resolved hurrily.
Summary of the invention
A purpose of the present invention is to provide a kind of asynchronous socket means of communication, the transmission data integrity, and data can not run off; Accelerate the communication transmission speed; Guarantee that under the situation of unstable networks, the socket message queue can not block.
A purpose of the present invention is to provide a kind of mobile phone positioning system that adopts asynchronous socket communication, can tackle network and unsettled special status occur.
In order to achieve the above object, the invention provides a kind of asynchronous socket means of communication, described method comprises: asynchronous socket with the message deposit that receives in messaging list; Control described messaging list length by semaphore,, then continue to receive message if messaging list length does not reach the setting maximum; If messaging list length reaches the setting maximum, then lock described information list by described semaphore, the message in the messaging list is taken out and sent; And semaphore wakes described messaging list continuation reception message up after sending.
Wherein, in specific embodiment, described setting maximum is to set according to the speed that message sends, and guarantees that under the situation of unstable networks, the socket message queue can not block.Employing group crossfire form sends the message content in the messaging list, and described group of crossfire form is that the message in the messaging list is formed character string or code stream string.Described message is by disposable taking-up and transmission.Therefore, can accelerate transfer rate.
In one embodiment, described method also is included in and receives and transmission message, need carry out information translation according to the smpp agreement.
A kind of mobile phone positioning system that adopts 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 demonstration, and sends position enquiring information; Described GIS server provides the geographical location information service; Described sms center is set up the socket communication with described socket communication server and is connected, and transmits 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 according to position enquiring information in described GIS server, and is transmitted to the socket communication server; Described socket communication server is to set up the socket communication respectively to connect between described sms center and described Service Processing Module, carry out information translation according to the information translation agreement, with the message deposit that receives in messaging list, control described messaging list length by semaphore:, then continue to receive message if messaging list length does not reach the setting maximum; If messaging list length reaches the setting maximum, then lock described information list by described semaphore, the message in the messaging list is taken out and sent, transmission back semaphore wakes described messaging list up and continues to receive message.
In specific embodiment, described agreement is the smpp agreement, is the conversion of decoding and encoding according to described Service Processing Module and the required information of sms center.Described setting maximum is to set according to the speed that message sends.Described socket communication server is that employing group crossfire form sends the message content in the messaging list, and described group of crossfire form is that the message in the messaging list is formed character string or code stream string.Message is by disposable taking-up and transmission in the described socket communication server.
A kind of asynchronous socket means of communication of the present invention have the following advantages: message deposit is in information list, and the socket message of transmission can not lost; The speed that transmits is accelerated in the disposable transmission of all message in the tabulation; Size according to actual conditions adjustment queue length guarantees that under the situation of unstable networks, the socket message queue can not block.A kind of mobile phone positioning system that adopts asynchronous socket communication of the present invention, on the basis of above-mentioned advantage, its positioning function can be tackled network and unsettled special status occur.
Description of drawings
Fig. 1 is an asynchronous socket means of communication flow chart 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 specific instantiation explanation embodiments of the present invention, those skilled in the art can understand other advantages of the present invention and effect easily by the content that this specification disclosed.The present invention also can be implemented or used by other different instantiations, and the every details in this specification also can be based on different viewpoints and application, carries out various modifications and change under the purpose of the present invention not deviating from.
A kind of asynchronous socket means of communication of the present invention are to be applied in asynchronous socket communication field.
Seeing also Fig. 1, is to show asynchronous socket means of communication flow chart of the present invention, and as shown in the figure, a kind of asynchronous socket means of communication of present embodiment comprise:
Step S11, receiving thread continue to receive the data of another node or module transmission by socket;
Step S12 by the tabulation of semaphore control messages, judges whether messaging list length reaches the setting maximum;
Step S13, if messaging list length do not reach the setting maximum, then with the message deposit that receives in described messaging list, and then carry out step S11, promptly receiving thread continues to receive message;
Step S14 if messaging list length reaches the setting maximum, then locks described information list by semaphore;
Step S15 sends thread destination node is taken out and sent to the message in the messaging list;
Step S16, after message sent, semaphore woke described messaging list up, continued to receive message, and carried out step S12, and communication so circulates.
Wherein, in the present embodiment, described setting maximum is to set according to the speed that real messages sends, be that described setting maximum is variable, dynamic, for example, can set this setting maximum according to the speed that receives or send the last lower node place of message, can guarantee that like this under the situation of unstable networks, the socket message queue can not block.In addition, can also employing group crossfire form send the message content in the messaging list, described group of crossfire form is that the message in the messaging list is formed character string or code stream string, and described message is by disposable taking-up and transmission, therefore, can accelerate message transmission speed like this.
In the present embodiment, the described asynchronous socket means of communication also comprise: when receiving and send message, need carry out information translation according to the smpp agreement, promptly after receiving bottom data, need earlier it to be converted into the data that the upper strata needs by smpp information translation protocol-decoding, the same manner is changed in the other direction.
A kind of asynchronous socket means of communication of the present invention have the following advantages: message deposit is in information list, and the socket message of transmission can not lost; The speed that transmits is accelerated in the disposable transmission of all message in the tabulation; Size according to actual conditions adjustment queue length guarantees that under the situation of unstable networks, the socket message queue can not block.
See also Fig. 2, be to show that the present invention adopts the mobile phone positioning system block diagram of asynchronous socket communication, as shown in the figure, the invention provides a kind of mobile phone positioning system that adopts 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 and described sms center 12 are connected by mobile radio network, can receive geographical location information and demonstration, and send position enquiring information, promptly major function is to receive the message of sms center 12 transmissions and send message to sms center 12.Wherein, described mobile radio network can be GSM network or cdma network, or other communication network, and public network or private network all can.
Described GIS (GIS-Geographic Information System, Geographic Information System) server 11 provides the geographical location information service, for example the obtaining of geographic position data, store, show, service such as editor, processing, analysis, output and application.
Described sms center 12 is set up the socket communication with described socket communication server 14 and is connected, transmit position enquiring information and geographical location information, be that described sms center 12 major functions are that the information and sending that receives socket communication server 14 is given mobile phone terminal, and mobile phone is sent content be transmitted to socket communication server 14.
Described Service Processing Module 13 and described GIS server 11 are connected by network, inquire about relevant geographical location information according to position enquiring information in described GIS server 11, and are transmitted to socket communication server 14.The major function that is described Service Processing Module 13 is the message warehouse-in that receives socket communication server 14; The geographical location information of searching the 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 the socket communication server by webpage.
Described socket communication server 14 is to set up the socket communication respectively to connect between described sms center 12 and described Service Processing Module 13, it is to control described messaging list by semaphore that this socket communication connects: mainly be to judge whether messaging list length reaches the setting maximum, if reach the setting maximum, then lock described information list, message is sent the back semaphore wake described messaging list continuation reception message again up by described semaphore.
In the present embodiment, described agreement is the smpp agreement, is the conversion of decoding and encoding according to described Service Processing Module 13 and sms center 12 required information.Described setting maximum is to set according to the speed that message sends, and for example sets this setting maximum according to the speed of message sink in sms center 12 or the Service Processing Module 13 and transmission.Described socket communication server 14 is that employing group crossfire form sends the message content in the messaging list, and described group of crossfire form is that the message in the messaging list is formed character string or code stream string.Message is by disposable taking-up and transmission in the 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, need deployment socket communication server 14, Service Processing Module 13, sms center 12, GIS server 11, socket communication server 14 to set up the socket long-chain with sms center 12 and Service Processing Module 13 and connect, can send out message mutually; Mobile phone terminal 10 can send out positioning command message or positional information is given sms center 12, and sms center 12 sends to socket communication server 14; Service Processing Module 13 shows on map according to the legitimacy of verification consumer positioning with according to position enquiring information inquiry GIS server 11, or converts geographical location information to.
The step of the mobile phone positioning system of the asynchronous socket communication of whole employing operation can be, for example:
1, socket communication server 14 starts, and foundation is connected with sms center 12 with Service Processing Module 13 and is connected.
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 is opened listening port, sets up to be connected with Service Processing Module 13, starts one and sends thread and receiving thread.
2, mobile phone terminal 10 by sms center 12 send position requests or position enquiring information to socket communication server 14 after, socket communication server 14 is deposited in message content in the messaging list.
3, by semaphore control information list length, reach locking information tabulation after the maximum, send the follow-up messaging list content of continuing.
4, come the setup message list length according to the message transmission speed, reach transmission speed and do not produce the equilibrium value that message is blocked.
5, socket communication server 14 once takes out the composition crossfire to the messaging list content and sends to Service Processing Module 13, accelerates message transmission speed.
6, Service Processing Module 13 is gone into database, carries out the user validation verification or according to position enquiring information GIS server 11 inquiring user positional informations.
7, Service Processing Module 13 sends to socket communication server 14 to 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, thereby finishes the function of mobile phone terminal location.
In sum, a kind of asynchronous socket means of communication of the present invention, be to lock and the wakeup message formation by semaphore, it can be the socket communication of a large amount of interacting messages between the disparate modules of two nodes or same node, message deposit in messaging list, thread is got list message and is formed character string or the transmission of code stream string, and when messaging list length arrived the setting maximum, semaphore pinned tabulation, after sending message, semaphore wakes thread up and resumes operation, and therefore, has accelerated the speed of transfer of data, especially at the network service less stable, when socket blocks, promptly prevent losing of information, guaranteed the smooth communication of socket.The mobile phone positioning system that adopts asynchronous socket communication makes the mobile phone location can tackle network and unsettled special status occurs on above-mentioned advantage basis, is fit to the application under the particular surroundings more.
The above-mentioned description to embodiment is can understand and use the present invention for ease of those skilled in the art.The person skilled in the art obviously can make various modifications to these embodiment soon, and needn't pass through performing creative labour being applied in the General Principle of this explanation among other embodiment.Therefore, the invention is not restricted to the embodiment here, those skilled in the art should be within protection scope of the present invention for improvement and modification that the present invention makes according to announcement of the present invention.

Claims (10)

1. asynchronous socket means of communication is characterized in that comprising step:
Receiving thread continues to receive message;
By semaphore control messages tabulation, if messaging list length does not reach the setting maximum, then with the message deposit that receives in described messaging list; If messaging list length reaches the setting maximum, then lock described information list by described semaphore, send thread message is taken out and sent;
Sending thread continues the message in the messaging list is taken out and sent; And message transmission back semaphore wakes described messaging list continuation reception message up.
2. the asynchronous socket means of communication according to claim 1 is characterized in that: described setting maximum is to set according to the speed that message sends.
3. the asynchronous socket means of communication according to claim 1 is characterized in that: employing group crossfire form sends the message content in the messaging list, and described group of crossfire form is that the message in the messaging list is formed character string or code stream string.
4. the asynchronous socket means of communication according to claim 1 is characterized in that: described message is by sending disposable taking-up of thread and transmission.
5. the asynchronous socket means of communication according to claim 1 is characterized in that: when also being included in reception and sending message, need carry out information translation according to the smpp agreement.
6. mobile phone positioning system that adopts asynchronous socket communication, 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 receive geographical location information and demonstration, and send position enquiring information; Described GIS server provides the geographical location information service; Described sms center is set up the socket communication with described socket communication server and is connected, and transmits 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 according to position enquiring information in described GIS server, and is transmitted to the socket communication server; Described socket communication server is to set up the socket communication connection of controlling described messaging list by semaphore between described sms center and described Service Processing Module respectively.
7. the mobile phone positioning system of the asynchronous socket communication of employing according to claim 6, it is characterized in that: described agreement is the smpp agreement, is the conversion of decoding and encoding according to described Service Processing Module and the required information of sms center.
8. the mobile phone positioning system of the asynchronous socket communication of employing according to claim 6, it is characterized in that: described socket communication server is that employing group crossfire form sends the message content in the messaging list, described group of crossfire form is that the message in the messaging list is formed character string or code stream string, disposable taking-up and transmission.
9. the mobile phone positioning system of the asynchronous socket communication of employing according to claim 6, it is characterized in that: the described socket communication connection of controlling described messaging list by semaphore, be to judge whether messaging list length reaches the setting maximum, if reach the setting maximum, then lock described information list, message is sent the back semaphore wake described messaging list continuation reception message again up by described semaphore.
10. the mobile phone positioning system of the asynchronous socket communication of employing according to claim 9 is characterized in that: described setting maximum is to set according to the speed that message sends.
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 true CN102045654A (en) 2011-05-04
CN102045654B 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)

Cited By (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
EP2899944A4 (en) * 2012-10-30 2015-07-29 Zte Corp Socket processing method and device and web server
CN106412861A (en) * 2016-09-28 2017-02-15 海南港澳资讯产业股份有限公司 Short message distribution method and system
CN106487945A (en) * 2016-09-09 2017-03-08 中国互联网络信息中心 A kind of DNS forwarding inquiries method
CN107066342A (en) * 2017-04-24 2017-08-18 厦门幻世网络科技有限公司 Information displaying method and device
CN108200544A (en) * 2018-03-02 2018-06-22 北京国电通网络技术有限公司 Short message delivery method and SMS platform
CN113347151A (en) * 2021-04-28 2021-09-03 厦门海迈科技股份有限公司 Data interaction method based on socket shared memory

Family Cites Families (2)

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

Cited By (13)

* 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
EP2899944A4 (en) * 2012-10-30 2015-07-29 Zte Corp Socket processing method and device and web server
US9871885B2 (en) 2012-10-30 2018-01-16 Zte Corporation Socket processing method and device and web server
CN106487945A (en) * 2016-09-09 2017-03-08 中国互联网络信息中心 A kind of DNS forwarding inquiries method
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
CN106412861A (en) * 2016-09-28 2017-02-15 海南港澳资讯产业股份有限公司 Short message distribution method and system
CN107066342A (en) * 2017-04-24 2017-08-18 厦门幻世网络科技有限公司 Information displaying method and device
CN107066342B (en) * 2017-04-24 2020-07-31 厦门黑镜科技有限公司 Information display method and device
CN108200544A (en) * 2018-03-02 2018-06-22 北京国电通网络技术有限公司 Short message delivery method and SMS platform
CN108200544B (en) * 2018-03-02 2021-12-28 北京中电普华信息技术有限公司 Short message issuing method and short message platform
CN113347151A (en) * 2021-04-28 2021-09-03 厦门海迈科技股份有限公司 Data interaction method based on socket shared memory
CN113347151B (en) * 2021-04-28 2023-04-28 厦门海迈科技股份有限公司 Data interaction method based on socket shared memory

Also Published As

Publication number Publication date
CN102045654B (en) 2015-01-28

Similar Documents

Publication Publication Date Title
EP0825788B1 (en) Two-way wireless messaging system with flexible messaging
CN102045654B (en) Asynchronous socket communication method and mobile phone positioning system using same
CA2206218C (en) Two-way wireless cellular messaging system
US6791962B2 (en) Direct link protocol in wireless local area networks
US6014429A (en) Two-way wireless messaging system with transaction server
US10244500B2 (en) Open wireless architecture (OWA) mobile cloud infrastructure and method
US20070060174A1 (en) Methods, systems, and computer program products for updating message routing profiles
CN100349477C (en) Method for group transmittings short message
CN102892093A (en) Mobile communication network expansion communication system and method of big dipper RDSS (radio data system) system
JP2007325190A (en) Push gateway, in-service registration server, portable terminal, push system and push method
DE60101671D1 (en) FORWARDING SHORT MESSAGES IN A TELECOMMUNICATION SYSTEM
CN104410982A (en) Terminal aggregation and refactoring method in wireless heterogeneous network
KR100495369B1 (en) Multimedia Messaging Service Method, Multimedia Messaging System and Multimedia Wireless Communication Terminal Equipment
CN105208533A (en) Message interaction method and device
US20090016166A1 (en) Text message activated alarm clock
CN102118854A (en) Method for tracking and sharing information on mobile phones
CN101835109B (en) Business Initiator's method and terminal
CN102083021B (en) Short message retransmission method in short message service (SMS) system and SMS system
KR20070023951A (en) Method for transmitting message based on zigbee networks
KR100882357B1 (en) System and method for connecting call of the lost terminal
JP2007170911A (en) Communication control system for alarm system, alarm apparatus, and alarm center device
CN201813536U (en) Mobile communication off-site data sharing system
CN101895861B (en) Method and system for realizing generic authentication architecture
CN101106740A (en) A processing method for self-service message
CN100353781C (en) Network and method for sending group short messages

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.