11. How to Receive SMS Messages Using a Computer / PC?
In general, there are three ways to receive SMS messages using your computer / PC:
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.
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.
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:
New message indications
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.
+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.
Here is a description of what is done in the above example:
Line 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.
Line 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 supported.
Line 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 before.
Line 11: The result code "OK" indicates the execution of the AT command +CMGL is successful.
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|
- 1. Introduction to SMS Messaging
- 2. What Makes SMS Messaging So Successful Worldwide?
- 3. Example Applications of SMS Messaging
- 4. What is an SMS Center / SMSC?
- 5. Basic Concepts of SMS Technology
- 6. Intra-operator SMS Messages
- 7. Inter-operator SMS Messages
- 8. International SMS Messages
- 9. What is an SMS Gateway?
- 10. How to Send SMS Messages from a Computer / PC?
- 11. How to Receive SMS Messages Using a Computer / PC?
- 12. Introduction to GSM / GPRS Wireless Modems
- 13. How to Use Microsoft HyperTerminal to Send AT Commands to a Mobile Phone or GSM/GPRS Modem?
- 14. Introduction to AT Commands
- 15. General Syntax of Extended AT Commands
- 16. Result Codes of AT Commands
- 17. AT Command Operations: Test, Set, Read and Execution
- 18. Testing the Communication between the PC and GSM/GPRS Modem or Mobile Phone
- 19. Checking if the GSM/GPRS Modem or Mobile Phone Supports the Use of AT Commands to Send, Receive and Read SMS Messages
- 20. Operating Mode: SMS Text Mode and SMS PDU Mode
- 21. Setting or Reading the Service Center Address / SMSC Address (AT+CSCA)
- 22. Preferred Message Storage (AT+CPMS)
- 23. Writing SMS Messages to Memory / Message Storage (AT+CMGW)
- 24. Deleting SMS Messages from Message Storage (AT+CMGD)
- 25. Sending SMS Messages from a Computer / PC Using AT Commands (AT+CMGS, AT+CMSS)
- 26. Reading SMS Messages from a Message Storage Area Using AT Commands (AT+CMGR, AT+CMGL)
- 27. Appendix A: How to Choose an SMS Service Provider (SMS Gateway Provider, SMS Reseller, SMS Broker)?
- 28. Appendix B: Comparison Table of SMS Service Providers (SMS Gateway Providers, SMS Resellers, SMS Brokers)
- 29. Appendix C: Free Software/Tools and Libraries for Sending and Receiving SMS Messages with a Computer / PC
- 30. Appendix D: GSM 7-bit Default Alphabet Table (with Character Codes of ISO 8859 Latin 1)