Are you thinking to use your SIM900 GSM/GPRS module as TCP server then you should re consider your decision. Because although SIM900 can run as a TCP server and has all the commands and software support inside, it cannot be directly used.

SIM900 supports TCP communication in both client mode and server mode. Client mode is straight forward and you can see the tutorial at this link,

https://www.youtube.com/playlist?list=PL6peP1Mv7tr9SwnGYfLsweYuuE9COKG9H

 

How to get SIM900 running as a TCP server?

Now if you want to use SIM900 as TCP server you need to get its Public IP address and not the one you get when you issue the command AT+CIFSR because it is a local IP address. To get the public IP address you need to connect to some server and note down the IP address shown there. 

For example, Here i am using the socket test application as  a TCP server and connecting to it via SIM900 as a TCP client. The socket test application shows me the IP address of the connected client, which here is the SIM900 module. 

The SIM900 AT commands for configuring it as a TCP server are shown at this link, 

 

Shocking part!!

If you are thinking, "Yes, we got the public IP and now we can just configure SIM900 as TCP server and connect to it." ... No you can't !!

I too was shocked when i came to know about this. The network service provider companies don't allow inbound connections, so no external device can directly connect to the SIM900 running as a TCP server. Because they use shared IP addresses and a single public IP address is shared by many more devices like SIM900.

 

Whats the Solution?

So if you want to use a SIM900 as a TCP server you need to get a private APN and a static IP from the network provider and connect. Its expensive and not affordable for small players and hobbyists. But there is no other option.  Without this, its not possible ! 

Source: Reply from M2M company,

While using our test package, IP addresses are assigned dynamically to the devices because the test package includes our shared APN m2m.tag.com.

For this APN we are using the NAT method, which means that privates IP addresses are assigned to the devices, which are NATed to the public IP 78.95.39.62.

Therefore inbound connections to the SIM cards are not possible while using this APN (or any other APN with NAT).

If you need these functionalities ins the future, we recommend to order a private APN with VPN/IPsec connection. Another advantage of a private APN is, that

you can define if the IP address assignment should be dynamic or static.

P.S: If anyone got it working i would be happy to know, please leave a comment.

 

Also see:

 




About the Author

is the author of this blog and is an Embedded systems design engineer by profession & Founder @ Valetron Systems Pvt Ltd


Email:This email address is being protected from spambots. You need JavaScript enabled to view it.

Find us on Google+

HIRE ME FOR YOUR PROJECT AS A FREELANCER

 

EasyEDA: Free Circuit Design Software

  • Easy Schematic Capture
  • Powerful Circuit Simulation
  • Online PCB design

Design Your Circuit and PCB here:

https://easyeda.com/editor

Cheap PCB Manufacturing