UDP socket and GPRS network messaging

Hi there,

I have an application that sits between mobile devices and another application.
I use UDP socket from mobile devices (GPRS network the device uses a modem and SIM card) to my application and TCP from my application to the second application. the mobile device is supposed to send a message to my app and from my app to the 2nd application and the second application sends a response back to that specific device via my application. So I record mobile id and IP and port that I got the message from and save it in a memory to use it for response back to the device. the problem is when my application crashes, I lose all the IP and port information and the message that should go to the mobile device would not get it there until I get a message from the mobile and save the info. I tried to save all the info in a file and read it back in start up but I noticed that when I restart my application the port number for the specified device will change and the information that I saved is useless (i.e. I am sending a message to an IP (which is correct) and a port (that has changed)). My question is like this: is there anyway to use UDP sockets and send/ receive messages but just use a specific IP for each device and do not use any PORT? and if there is, I'll be appreciated if somebody get me a clue.

here is what happens for me now:

Device to App:

got a message:
look for device ID and save the IP and PORT for that:
Mobile# Z, IP: xxx.xxx.xxx.xxx port: xxxx

App to Device

Message is supposed to go to device Z --> get the IP and Port

send message to xxx.xxx.xxx.xxx port xxxx

if My app restarts and I get a message to send to device Z, the port is changed and the message never gets to that unless I get a message from the device and update my information.
Due to data usage and as we use VPN tunnel we send heartbeat message every 40 minutes, so the information might not be very updated.



  • Hi There
    Mybe you solv your problem using a SIM
    card with FIX IP.
    I have a similar project.
    How do you comunicate from server to
    device? You use internet or only GPRS
    Can you send me your source code?


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion