Jari Niskala

Hi,

I have a client that runs on a Windows Mobile device (using Blackjack for testing) and it connects to a server that runs on a Windows box. The client initiated connections using TCP to the server work great, but I cannot seem to be able to receive any server initiated UDP messages on the phone. The UDP messages are used as a kind of a 'refresh' message to the client to tell it to resync it's data with the server.

My data connection is over GPRS (Edge). I've been pulling my hear out on this one for a bit now and I can't seem to find anything online about UDP messages not being received on the phone so I'm hoping someone can help me here.

So the specific question is: Is it possible to receive UDP messages on the device when using GPRS Any other pointers, tips appreciated.

Thank,
Jari


Re: Smart Devices General UDP over GPRS

Christopher Fairbairn

Hi,

Jari Niskala wrote:
So the specific question is: Is it possible to receive UDP messages on the device when using GPRS Any other pointers, tips appreciated.

Yes it is possible. I have previously worked on a large enterprise level application built on the Windows Mobile platform which soely used UDP to communicate over a wide range of network types (including GPRS) in a number of regions world wide.

It is not without it's challenges though.

Can you explain when/how you are attempting UDP communications. Are you storing the IP address of the PDA and at some stage in the future sending a UDP packet

If you send a UDP message from your PDA and monitor the PDA's IP address from the server you will probably see the IP address changing every so often even though you are using the same PDA for all tests and it hasn't lost GPRS coverage during the test.

Most teleco's have a fixed number of routable IP addresses (much less than the number of customers they have), so access to the internet etc goes through a gateway which allocates them an address out of a pool. These allocations typically have a timeout associated with them (in my experience anywhere between 5 and 30 minutes), i.e. if you dont' send or reiceve a packet in this timeframe the allocation disappears and the next time your PDA attempts to access the internet it appears to be via a different IP address/port combination.

This is a problem with server originated UDP packets since you might be sending it to an "old" IP address/port number etc. Our custom protocol resolved this because we could tune the frequency the handheld sent "ping" or "keep-alive" style UDP packets to the server (which the server recorded as the PDA's last known IP address). These packets kept the gateways happy, and since we were sending these messages for application logic reasons anyway it didn't significantly increase data charges occurred by our customers.

Hope this helps,

Christopher Fairbairn






Re: Smart Devices General UDP over GPRS

Jari Niskala

Hi Christopher,

Thank you for your response. This does clear up a lot.

In our case the client does report the IP address to the server which is then used by the server to send the UDP packet.

For some reason though even when the IP address hasn't changed, the UDP packets aren't received on the client, but at least knowing that it should be possible while the IP hasn't changed is great.

Now is there anything specific that you can think of regarding setting up the socket etc on the client side

Currently the client does the following:

1. Create socket

socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);

2. Bind the socket to:

sin_family = AF_INET;
sin_addr.s_addr = htonl(INADDR_ANY);
sin_port = htons(port); // 52311

3. Make it non-blocking (i've also tried the socket in blocking mode)


And thanks again for your response.

BR,
Jari




Re: Smart Devices General UDP over GPRS

Jari Niskala

Did some more digging around on this and found out that depending on the carrier, mine is Cingular/ATT, a static IP might be required in order to be able to receive UDP/TCP connections. This can be requested from the carrier (haven't done this yet).

Since this is dependent on the carrier, it's best to check directly with your carrier.

Hope this will save someone else a lot of time and headache.

BR,
Jari