I am trying to work with a few GPS-enabled tracking devices one of them being a TK-303 GPS tracker that uses SIM-powered GPRS to access the internet. currently, I can receive messages on my python TCP socket server. but when I tried initiating a connection to the devices using the public address that is broadcasted when the device sends a message, the connection wouldn't connect. my question is how is this done, I would like insight on how to go about doing this. thank you.

  • 1
    Note that GPRS is a 2G technology, and that most 2G networks have either already been turned off or are scheduled to be turned off in the near future. If you want anything that will last at least a few years it would be a good idea to switch to something a bit more recent. Also having a wireless device constantly waiting for incoming data will usually require optimisations if you want the device to last more than a few hours on battery.
    – jcaron
    Jul 30, 2022 at 21:00

1 Answer 1


Data transfers have to be initiated by the GPRS module; your cellular provider will have a firewall that blocks all connection requests that originate from the internet.

The usual way round this is to send an SMS to the tracker, which can either return its position in an SMS, or be triggered to initiate contact with a server.

  • Yeah, I currently use the SMS functionality. but the documentation of the device states that one can communicate with it also using a TCP connection. since that would be easier and less costly was why I was thinking of that option and also the fact that SMS is not that reliable, especially in the region where the module will work. Jul 30, 2022 at 8:55
  • 1
    If SMS is not reliable, then GPRS data connection is likely to be none existent. SMS uses the 2G management channels that are used to setup/manage new calls/data connections and cell hand off. If they are not working nothing will work. Also unless you are paying for a dedicated IoT SIM that comes specifically with a public IP address then your connection will be behind a CGNAT deployment and there will be NO direct route to your device from the public internet. The only way to communicate with it will be if it initiates the connection.
    – hardillb
    Jul 30, 2022 at 11:56
  • Interesting, thanks very much. that clears a lot. is it possible though to reuse the connection created by the devices for sending commands to it? i.e if the device sends a message, can I reply with the response and also a command to execute ?. because I always think of the connection from the device as a single request -> single response kind of connection. Jul 30, 2022 at 20:09
  • TCP/IP is a bidirectional pipe, what you send in either direction is entirely up to you once the connection has been formed.
    – hardillb
    Jul 30, 2022 at 21:01
  • Once the remote unit has set up a connection, you can transfer data bidirectionally, but do bear in mind that your GPRS connection is quite unreliable; the connection may be set up, but then the mobile unit loses the wireless signal, so the transaction is stalled for a while. To avoid this, it is best to keep transactions brief, and close the connection as quickly as possible. Alternatively, use UDP instead of TCP, with a lightweight retry layer on top, which can quickly detect when the network connectivity drops out.
    – jayben
    Jul 31, 2022 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.