GPRS Byte counter - Windows Mobile Development and Hacking General

I need to implement a GPRS byte counter in my code. Currently I'm using the GetIfTable Function API function. It seems to work for GPRS only some times. It the only network adapter it finds is TNETW12511. I can point to it and as long as wifi has previously been enabled (but not currently running), this api returns GPRS bytes properly. Every once in a while however it keeps returning zero bytes even though I know GPRS is being transmitted and received.
Is there a better way to monitor GPRS traffic statistics?

Related

GPRS push?

Hi all,
I'm brand new to mobile / pocket pc development, I just have a few networking related questios though.
I'm implementing my own blackberry style client/server for my brand new (got it yesterday) XDA IIi.
From what I've read the IP address of a mobile connected to GPRS will change every data session, so even though it has stayed 'online' all day it may have multiple IP addresses throughout the day. How do the blackberry style systems get around this? Is this todo with the IMS / SIP protocol ?
What I'm wanting is so that the mobile phone doesn't have to send any data to the server (apart from an initial hello) and then when mails come in the server can send directly to the mobile. Obviously with changing IP addresses this is impossible unless each time the IP changes the mobile tells the server, effectively you are not really pushing any more then it's more of a poll.
Also one more question on a non-development note, do providers charge for dropped packets or are they dropped normally before their routers so they simply never see them?
BTW I will be releasing the software I'm working on when done so don't fear
Thanks
bump ?
I guess not much known about GPRS / Blackberry workings ?
You can use WAP push to get in touch with the client on a Pocket PC Phone Edition. Have a look in the Phone API at msdn. I think you'll find something there...
Thanks! Totally forgot about checking MSDN ;P
This is possible, I do something similar. But it's difficult.
The IP assigned to your device is in private address space, using NAPT to contact Internet. Therefore you cannot contact the device IP in any way.
You can however open a connection from the XDA to any host on the Internet using TCP. Once this connection is open, it will remain open indefinitely. Or about 30 minutes if no data is transferred.
Once you have an open TCP connection, you can push data down the tunnel in either direction with very low latency. It is up to you to find a suitable protocol to run over your open tunnel.
Several things also need checking:
- Send some data every few minutes to keep connection open.
- Watch for stale GPRS connections. If this happens, remake the connection.
- Packets do get lost. Ensure all packets checked, resend if needed. You can use the TCP 'ACK' packet, or use your own acknowledgement protocol.
If you get it working, it works surprisingly well.
Hope this is of some use,
Ben Clewett.

WM5 data connection timeout setting

does anyone know where the timeout for the active data (GPRS/UMTS) connection is located? i've wandered the registry on my 8525, but didn't see it...also didn't see any info in the general or hermes registry wiki pages.
before upgrading to AKU3.3 (cingular 2.06 ROM), my data connection used to stay up for a long time even when unused, sometimes staying connected for 30 minutes or more without active data. now it's only staying up for about a minute before it disconnects again - this can lead to a reconnect delay every time i load a new page in PIE. when i had the original cingular 1.34 ROM, the connection worked fine.
i haven't made any changes to my account, so i don't think this is network related. this issue occurs regardless of APN, and my other two data devices (using the same APN) do not experience this. if i switch sim cards, the 8525 continues to drop the connection.
anyone have an idea on this? searching on the forums pulled up threads related to keeping the connection alive indefinitely, but this doesn't appear to be a great option as it continually tries to reconnect (with the popup bubble blocking the screen) in areas with poor/no signal.
tia.
well...as i expected, there is no client side timeout and the problem does appear to be related to the APN. i retested using wap.cingular, isp.cingular, and internet...and the problem only occurs when using isp.cingular or internet. wap.cingular doesn't appear to timeout at all (or at least over 15 minutes), while the others now drop 60 seconds after the last data transfer.
i know isp.cingular hasn't always disconnected after 60 seconds...something must have changed on the server side in the last couple weeks. my guess is that cingular is feeling a squeeze on public ip allocation due to the increase in data devices, and this is their solution. wap.cingular uses private ip blocks, and as such there is no problem with limited ip addresses.
because of the timing, i just attributed the issue to the 2.06 rom upgrade. hope this helps someone else!
Thank you for taking the trouble to update on that point. Useful info.
Mike
more APN tests
after doing some tests to figure out why my data connection was being dropped every 60 seconds...i've come up with some interesting information. testing done with an 8525 w/cingular 2.06 ROM and an option gt max 3.6, and their respective sim cards (8525 w/pda connect, gt max w/laptop connect) swapped between the two.
cingular 8525 / pda connect sim card
wap.cingular with proxy functions normally and does not timeout.
wap.cingular without proxy functions normally and does not timeout.
isp.cingular functions normally, but times out after 60 seconds of inactivity.
internet functions normally, but times out after 60 seconds of inactivity.
option gt max 3.6 / laptop connect sim card
wap.cingular functions normally and does not timeout.
isp.cingular functions normally and does not timeout.
internet functions normally and does not timeout.
cingular 8525 / laptop connect sim card
wap.cingular with proxy functions normally and does not timeout.
wap.cingular without proxy functions normally and does not timeout.
isp.cingular functions normally, times out after 60 seconds of inactivity.
internet functions normally, times out after 60 seconds of inactivity.
option gt max 3.6 / pda connect sim card
wap.cingular functions normally and does not timeout.
isp.cingular functions normally and does not timeout.
internet functions normally and does not timeout.
routing was disabled to prevent any stray packets from keeping the connection alive when using the laptop data card, and there was no change in the sent/received kb. used a DUN connection, so there is no chance of the card's software interfering with the connection.
it appears that the isp.cingular and internet connections only times out when used with the 8525, and not with the data card. so now i'm back to examining the 8525 as the issue again...either there really was a change in the cingular 2.06 ROM, or maybe this indicates some kind of IMEI checking when attaching the PDP context (and setting the connection timeout)?

Multiple APN's?

I have enabled multiple APN's in my ROM (Vodafone UK SIM) by changing the registry entries:
Code:
HKEY_LOCAL_MACHINE\Software\OEM\RIL\OperatorContexts\23415] ;Vodafone UK
"GPRSContextNumber"=dword:3
"UMTSContextNumber"=dword:3
This allows me to have two simultaneous data connections (HSDPA/3G/GPRS). I noticed yesterday that when a voice call is made or received the 2nd data connection is disconnected and then reestablished when the call has ended. I changed each of the registry entries to 5 but the behaviour is still the same.
Is this a limitation of the ROM or the mobile contract? Is it possible to have two data connections as well as a voice call active at the same time? I use BlackBerry Connect and this keeps its data connection permanently active, if I browse the web or open another application that uses the Internet then the Vodafone GPRS connection gets established. I have now started to use Office Communicator Mobile 2007 R2 quite a lot and this uses the Internet data connection, however if a voice call is established then the OC 2007 R2 connection gets broken since the 2nd data connection is disconnected. This then screws up the presence status of OC 2007 R2.
Cheers
Andy
Solved....
I have now been moved over to Exchange ActiveSync and have removed BlackBerry Connect (thankfully..). However I am still having an issue
With BlackBerry Connect there was always a permanent data connection to the BlackBerry APN. Opening an Internet connection would cause a 2nd data connection to be made (to Vodafone APN). However if a voice call was made the Internet connection was dropped for the duration of the voice call. Now I have removed BlackBerry Connect I assumed that the data call would no longer disconnect as there is now only ever one active data connection. It seems I was wrong?
I have verified the GPRSContextNumber & UMTSContextNumber values in the registry for the Vodafone UK OperatorContexts are set to 3 (as they were previously) but the data connection is dropped when a voice call is made?
Solved it now after a bit more searching
There is a registry value that can be changed 'AllwaysOn' for each of the data connections that are configured on your device. On mine it was this:
Code:
[HKEY_LOCAL_MACHINE\Comm\ConnMgr\Providers\{7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA}\Connections\Vodafone GPRS]
"AlwaysOn"=dword:00000001
Some of the tweak utilities allow you to change this as well.
I assume on other devices the GUID will vary as well as the name you gave the connection settings - I used Vodafone GPRS.
Cheers
Andy
Andy,
Thanks for sharing your findings!
7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA is the default GUID for ConnMgr providers, will be the same on all devices. Connection names will vary indeed.
As regards your original problem, I think there could be several causes:
1. Concurrent PDP contexts limit in hardware, see
http://www.qualcomm.com/common/documents/white_papers/Multiple_PDP_Contexts_UMTS.pdf
2. ConnMgr is dropping insecure connection(s) when a connection to a secure network is required
I'm afraid your Internet APN may still go down when you place a phone call, however due to AlwaysOn it's reactivated instantly. Personally I never played with 2 contexts, but I've seen this behavior with AlwaysOn VPN connections.
stepw said:
Andy,
Thanks for sharing your findings!
7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA is the default GUID for ConnMgr providers, will be the same on all devices. Connection names will vary indeed.
As regards your original problem, I think there could be several causes:
1. Concurrent PDP contexts limit in hardware, see
http://www.qualcomm.com/common/documents/white_papers/Multiple_PDP_Contexts_UMTS.pdf
2. ConnMgr is dropping insecure connection(s) when a connection to a secure network is required
I'm afraid your Internet APN may still go down when you place a phone call, however due to AlwaysOn it's reactivated instantly. Personally I never played with 2 contexts, but I've seen this behavior with AlwaysOn VPN connections.
Click to expand...
Click to collapse
What about the value under \HKLM\Software\OEM\RIL\SAPOperatorList? Can this be trusted to be my providers OperatorContext number(s)?
Rob
Rob
stepw said:
Andy,
Thanks for sharing your findings!
7C4B7A38-5FF7-4bc1-80F6-5DA7870BB1AA is the default GUID for ConnMgr providers, will be the same on all devices. Connection names will vary indeed.
As regards your original problem, I think there could be several causes:
1. Concurrent PDP contexts limit in hardware, see
http://www.qualcomm.com/common/documents/white_papers/Multiple_PDP_Contexts_UMTS.pdf
2. ConnMgr is dropping insecure connection(s) when a connection to a secure network is required
I'm afraid your Internet APN may still go down when you place a phone call, however due to AlwaysOn it's reactivated instantly. Personally I never played with 2 contexts, but I've seen this behavior with AlwaysOn VPN connections.
Click to expand...
Click to collapse
As I said it is now fixed as I only ever have a single APN connection as I have moved over to Exchange ActiveSync and have also changed the 'AllwaysOn' registry value for the default GPRS connection.
Andy

How to keep GPRS connection alive

We have a WinMob application that sends and receives data over GPRS; and it works.
The problem we have occurs when the vehicle based PDA goes into an area of poor reception and WinMob thinks the data connection is working but no data is being transmitted. The application currently issues a disconnect request to the WinMob connection manager but WM6.* keeps the data connection.
We would like the PDA to drop the data connection and re-connect automatically when the application resumes data transmission after a short programmed delay.
We have tried changing the PDA's registry setting from ~GPRS! to GPRS_bye_if_device_off and setting a (90 second) timeout and this works. Except that even though the PDA issues a UDP packet to one of our servers every minute to keep a push link alive, WinMob ignores this packet and drops the connection ~100 seconds after connecting.
What do we need to receive/transmit to convince WinMob that the data connection is active? DO we need to issue a http get request after sending the UDP? We don't want to send/receive more data than we need (large phone bills!).
keep alive
tracktrans said:
We have a WinMob application that sends and receives data over GPRS; and it works.
The problem we have occurs when the vehicle based PDA goes into an area of poor reception and WinMob thinks the data connection is working but no data is being transmitted. The application currently issues a disconnect request to the WinMob connection manager but WM6.* keeps the data connection.
We would like the PDA to drop the data connection and re-connect automatically when the application resumes data transmission after a short programmed delay.
We have tried changing the PDA's registry setting from ~GPRS! to GPRS_bye_if_device_off and setting a (90 second) timeout and this works. Except that even though the PDA issues a UDP packet to one of our servers every minute to keep a push link alive, WinMob ignores this packet and drops the connection ~100 seconds after connecting.
What do we need to receive/transmit to convince WinMob that the data connection is active? DO we need to issue a http get request after sending the UDP? We don't want to send/receive more data than we need (large phone bills!).
Click to expand...
Click to collapse
I use android emulator to ping a google
eg ping google.com
Terminal emulator app for android keeps connection alive. Go to playstore and get it
Sent from my GT-I8260 using XDA Premium 4 mobile app

3G Data turning on when set to off

In one of my other post in General, I found that 3G data is turning on when it is set to disable in the settings on the Dell Streak 5,(Android 2.2 AT&T Locked US version) using 3G watchdog, I noticed I was using 3G data when I was supposed to be using only a WiFi connection. This occurs when on a WiFi connection and you access the Google Market Place.
Accessing the Market Place will turn on and activate and transfer 3G data to and from Google Market.
Turning off background data will cause the 3G data connection to not turn on.
This also cause Google Market Place to not function and states it needs the background data connection to be turned on.
Am I reading the coding wrong below?
Why am I incurring data charges when set to WiFi Only?
Why does Google Market Place need to open a 3G data connection when using WiFi?
Has anyone else noticed this?
Have you went over your data allotment and wondered why?
--------------------------------------------
public static final int TYPE_WIFI
Since: API Level 1
The Default WIFI data connection. When active, all data traffic will use this connection by default. Should not coexist with other default connections.
Constant Value: 1 (0x00000001)
---------------------------------------------
public static final int TYPE_MOBILE
Since: API Level 1
The Default Mobile data connection. When active, all data traffic will use this connection by default. Should not coexist with other default connections.
Constant Value: 0 (0x00000000)
----------------------------------------------
public static final int TYPE_MOBILE_HIPRI
Since: API Level 8
A High Priority Mobile data connection. This connection is typically the same as TYPE_MOBILE but the routing setup is different. Only requesting processes will have access to the Mobile DNS servers and only IP's explicitly requested via requestRouteToHost(int, int) will route over this interface if a default route exists.
Constant Value: 5 (0x00000005)
-------------------------------------------------
public boolean requestRouteToHost (int networkType, int hostAddress)
Since: API Level 1
Ensure that a network route exists to deliver traffic to the specified host via the specified network interface. An attempt to add a route that already exists is ignored, but treated as successful.
Parameters
networkType : the type of the network over which traffic to the specified host is to be routed
hostAddress: the IP address of the host to which the route is desired
Returns
• true on success, false on failure

Categories

Resources