11. How to Receive
SMS Messages Using a Computer / PC?
general, there are three ways to receive SMS messages using your
computer / PC:
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.
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
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.
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
11.1. The 1st Way:
Using a Computer to Receive SMS Messages through a Mobile Phone or
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.
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
following table lists the AT commands that are related to the
receiving and reading of SMS messages:
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.
welcome to our SMS tutorial.
simple demo of SMS text messaging.
is a description of what is done in the above example:
1: "AT" is sent to the
GSM / GPRS modem to test the connection. The GSM / GPRS modem sends
back the result code "OK" (line 2), which means the
connection between the HyperTerminal program and the GSM / GPRS
modem works fine.
3: The AT command +CMGF is used to instruct the GSM / GPRS modem to
operate in SMS text mode. The result code "OK" is returned
(line 4), which indicates the command line "AT+CMGF=1" has
been executed successfully. If the result code "ERROR" is
returned, it is likely that the GSM / GPRS modem does not support
the SMS text mode. To confirm, type "AT+CMGF=?" in the
HyperTerminal program. If the response is "+CMGF: (0,1)"
(0=PDU mode and 1=text mode), then SMS text mode is supported. If
the response is "+CMGF: (0)", then SMS text mode is not
5-9: The AT command +CMGL is used to list all SMS text messages in
the message storage of the GSM / GPRS modem. There are two SMS text
messages in the message storage: "Hello, welcome to our SMS
tutorial." and "A simple demo of SMS text messaging.".
"+85291234567" is the sender mobile phone number.
"06/11/11,00:30:29+32" and "06/11/11,00:32:20+32"
tell us when the SMS text messages were received by the SMSC. "+32"
is the time zone. Note that the unit is a quarter of an hour. So,
+32 means GMT+8 hours, since 32 quarters of an hour = 8 hours. "REC
READ" indicates both of the SMS text messages have been read
11: The result code "OK" indicates the execution of the AT
command +CMGL is successful.
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.
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".
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.
Feedback Form (ExpandCollapse)