Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
UDP socket and GPRS network messaging
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.
0 · ·