11. How to Receive SMS Messages Using a Computer / PC?

In general, there are three ways to receive SMS messages using your computer / PC:

  1. Connect a mobile phone or GSM/GPRS modem to a computer / PC. Then use the computer / PC and AT commands to get the received SMS messages from the mobile phone or GSM/GPRS modem.

  2. Get access to the SMS center (SMSC) or SMS gateway of a wireless carrier. Any SMS messages received will be forwarded to your computer / PC using a protocol / interface supported by the SMSC or SMS gateway.

  3. Get access to the SMS gateway of an SMS service provider. Any SMS messages received will be forwarded to your computer / PC using a protocol / interface supported by the SMS gateway.

If you do not want to develop SMS software or applications but just want to use your computer / PC to receive text messages, you may want to read our Quick Guide for Non-Developers.


11.1. The 1st Way: Using a Computer to Receive SMS Messages through a Mobile Phone or GSM/GPRS Modem

Receiving SMS messages through a mobile phone or GSM/GPRS modem has a major advantage over the other two ways -- wireless carriers usually do not charge any fees for receiving incoming SMS messages with their SIM cards. The disadvantage of receiving SMS messages this way is that a mobile phone or GSM/GPRS modem cannot handle a large amount of SMS traffic. One way to overcome this is to load balance the SMS traffic with a pool of mobile phones or GSM/GPRS modems. Each mobile phone or GSM/GPRS modem will have its own SIM card and mobile phone number.

In terms of programming, sending and receiving SMS messages through a mobile phone or GSM/GPRS modem are similar. What you need to do is to send instructions (in the form of AT commands) to the mobile phone or GSM/GPRS modem.

The following table lists the AT commands that are related to the receiving and reading of SMS messages:


AT command

Meaning

+CNMI

New message indications

+CMGL

List messages

+CMGR

Read messages

+CNMA

New message acknowledgement


Below shows a simple example that demonstrates how to use AT commands and the HyperTerminal program of Microsoft Windows to read SMS text messages received by a GSM / GPRS modem or mobile phone. The lines in bold type are the command lines that should be entered in HyperTerminal. The other lines are responses returned from the GSM / GPRS modem or mobile phone.


AT
OK
AT+CMGF=1
OK
AT+CMGL="ALL"
+CMGL: 1,"REC READ","+85291234567",,"06/11/11,00:30:29+32"
Hello, welcome to our SMS tutorial.
+CMGL: 2,"REC READ","+85291234567",,"06/11/11,00:32:20+32"
A simple demo of SMS text messaging.

OK


Here is a description of what is done in the above example:

To enable an application to receive SMS messages, you have to write the source code for connecting to and sending AT commands to the mobile phone or GSM/GPRS modem, just like what a terminal program (such as HyperTerminal of Microsoft Windows) does. You can write the source code in C, C++, Java, Visual Basic, Delphi or other programming languages you like.

However, like what we have discussed in the earlier section "The 1st Way: Sending SMS Messages from a Computer Using a Mobile Phone or GSM/GPRS Modem", usually a better solution is to use a high-level SMS messaging API (Application programming interface) / SDK (Software development kit) / library instead of writing your own code for interacting with the mobile phone or GSM/GPRS modem via AT commands. The API / SDK / library encapsulates the low-level details. So, an SMS application developer does not need to know AT commands and the composition of SMS messages in the bit-level. Some SMS messaging APIs / SDKs / libraries support SMSC protocols in addition to AT commands. To move from a wireless-modem-based SMS solution to a SMSC-based SMS solution, usually you just need to modify a configuration file / property file or make a few changes to your SMS messaging application's source code. The links to some open source and free SMS messaging libraries can be found in the article "Free Libraries/Tools for Sending/Receiving SMS with a Computer".

Another high-level solution is to place an SMS gateway between the SMS messaging application and the mobile phone or GSM/GPRS modem. The SMS messaging application can then use simple protocols such as HTTP / HTTPS for receiving SMS messages. If an SMSC protocol (e.g. SMPP, CIMD, etc) is used for communicating with the SMS gateway instead of HTTP / HTTPS, an SMS messaging API / SDK / library can be very helpful to you since it encapsulates the SMSC protocol's details.


Previous Page Page 14 of 65 Next Page

Contents at a Glance (Click Here for Full Table of Contents)

A button for going back to the top of this page