ConnectionLinkFailed on GPRS connection - c#

I'm using this sample code by CodeProject to connect to GPRS in a Windows Mobile in C#.
I tried the code and it works fine. However, sometimes I get a message saying "ConnectionLinkFailed" and I can't connect to GPRS.
I must wait some time in order to being able to connect again. Rebooting doesn't solve the problem either.
Does anyone knows how to avoid this exception?
Thanks for any help!

The MSDN site only states:
CONNMGR_STATUS_CONNECTIONLINKFAILED The connection link was prematurely disconnected.
There is no further description. I assume you have a problem with your provider. Beside from that, I do not rely on Connection Manager (CM) connections. Soemtimes it states a connection is available, but it is not in real as CM uses a cached information.
Normally, for getting a connection, you only have to issue a http request. CM will choose the right connection. Usa of CM API is only usefull if you need to switch between different connections with same destination network. But this i normally not the case, as you will have normally only a WiFi and one GPRS connection to internet and WiFi is selected prior to GPRS (due to costs).
What is the scenario that makes you think you have to use CM?

Related

Failover to 3G and back

I'm developing an app for remote monitoring of a small power plant. The idea is to keep the remote connection all the time.
We hava a small PC with broadband connection and in addition 3G/4G modem attached.
Checking the connectivity when I have broadband is quite easy for me.
fist I check if the interface that Im using is up, and then just with simple web client i check the response from google or any other site that I assume that should be online :-)
Im using System.Net.NetworkInformation.NetworkInterface.*
Then if there is no connection over the lan network Im connecting to 3G modem and starting 3G connection.
The problem is how to check if my lan connection again got the internet connection and disconnect 3G modem? How to check that particular interface from C# code that it has internet access?
Can I make some manual routing trough the interfaces, or its done somewhere inside the OS it self?
Some advice? Someone has got similar project?
Well you could fetch the Lan connection profile with the same library as the Profile Name is "Ethernet" and then to check you'll first need to connect to a LAN connection and then check and if the connection has internet access the stay else you'll have to switch back. I tried it it takes roughly 30 seconds to do a full route

Auto reconnection to TibcoEMS servers

Do I need to implement anything to enable the "retry to connect" or "failover to another server"? From what I understand, these two should be taken care of as long as I configure them correctly (aka a fault-tolerant connection url and ReconnAttemptCount, etc.) However, it doesn't work for me.
My current scenario is that my app successfully connects to the EMS server, it can receive and send msg. Then I disable network connection, I can see exception "TIBCO.EMS.EMSException: Connection has been terminated" is thrown. Enable network connection but the connection to EMS server does not automatically restore.
Please help to advise. If my understand is wrong, please help to correct me as I am very new in this area.

Find out Chat session is through VPN connection

Is there a way to find out whether the current chat session is happening through a VPN connection programatically (using either C# or Java) ?
I don't have access to network tools to do a R&D ( first of all not sure whether it can be tracked live), hence i haven't tried anything.
Any help/pointers/directions will of great help.
Thanks
I believe it would depend on how the VPN is set up.
If the VPN is connected using a software endpoint then it will normally have a simulated network adaptor that you could most likely find the name of (the hardware drivers display name not the connection name) and compare it to a list of known VPN network adaptors.
If the VPN is connected using a hardware endpoint like a firewall or other dedicated network device then there may be no way to tell without some sort of man in the middle hardware approach.

C# Windows Service that connects to network through VPN

I have a Windows Service that must connect, via VPN, to the network in order to send emails. What I need to do (when I start the service) is check whether the VPN connection exists, if not create it, and then connect to the network.
I was looking at DotRAS which looks ideal for doing all the work, however, it doesn't seem to provide a method for creating a new VPN connection.
So my question is, is there a way in which I can programmatically create a VPN connection?
Use a scriptable VPN client, and run it using Process.Start("path-to-your-script").
Depending on which client you use, you have different possibilities regarding monitoring the status of the VPN connection.
Here is an article where the Windows rasphone client is used in such a way.
My mistake, turns out DotRAS does have a method for creating new VPN connections :)

Closing GPRS Connections On Windows Mobile

Is it possible to get all open or cached gprs connections on windows mobile and programmatic force them to close?
Ive been looking at connection manager api but cant seem to find methods I to do this.
Regards
Tony
Connection Manager can be notified that you're no longer using the connection by calling ConnMgrReleaseConnection, but that does not forcibly close the connection. It is closed based on the lifetime caching defined in the registry (HKEY_LOCAL_MACHINE\Comm\ConnMgr\Planner\Settings), as well as any info passed in the Release request. (BTW, these APIs are wrapped in the OpenNETCF ConnectionManager objects in the SDF).
The only way to forcibly close the connection is to use RAS to enumerate all device connections, find the one you're after, and close it. Be aware that if you do this, ConnectionManager doesn't know that it's been closed, so it's going to be upset the next time it tries to use that connection. Typically it will get an error internally and try to open a new connection again and all is well, but YMMV.

Categories