Using SIM900 as TCP server ? – Read this first !!

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,


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

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

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:


Leave a Comment