G
Guest
I need to make an application (on a Pocket PC 2003) that automaticaly
reconnect when a connection is available. The application is connected live
to a SQLServer 2000 and when i get a broken connection, It shoud display a
message to the user
"Network connection lost, Reconnect?" Ok = Try to connect to the network
(available configured AccessPoint) an perform operation
Cancel = discard operation an wait until user try again
(the message will loop until success or cancel)
The application is destinated to verry novice user and
should be the most transparent as possible... down want them to get to the
device settings...
I'have tryed many things and nothings seem to work!
What i'm doing wrong... is it my device?
Is i understand something wrong?
The pocket PC is a DELL AXIM
2 Wifi acces point (MYACCESSPOINT no WEP KEY and MYACCESSPOINT2 with WEP KEY)
developping in C# using Visual Studio 2003 Compact Framework 1.0 with latest
service pack.
When i start Internet explorer, it automaticaly connect one of my prefered
access point! I also notice that where i am doing test there is a lot of not
configured device (and should hide the connect to a new network wizard)
== First setup: ==
I configure both as prefered devices and connect to one acces point
- I write a simple apps that open a connection on a SQL server on the network
- I goes out of scope the two acces point
- I came back near the acces point and wait... (1 minute and more)
- Try to re open the connection an get an error like "server does not exists"
== Second setup: ==
I read a bit an try the fallowing (with OpenNETCF),
after the error "server does not exists" i call my function
TakeConnection() but the code never break... so never get connected.. ;o(
private void TakeConnection()
{
ConnectionManager oCon = new ConnectionManager();
foreach( DestinationInfo d in oInfo )
{
bool connected = false;
if(d.description == "work")
{
oCon.Connect(d.guid, true, ConnectionMode.Asynchronous);
while(!connected)
{
if(_oCon.Status != ConnectionStatus.Connected)
{
System.Threading.Thread.Sleep(1000);
continue;
}
connected = true;
}
}
}
}
== Third setup: ==
I keept a member instance of ConnectionManager
and call a function like DoConnection at the form initialisation. (same as
TakeConnection with the global member)
The function also register to events OnConnect, OnDisconnect,
OnConnectionFailed, OnConnectionStateChanged...
When i start the app, i got the OnConnect, but when connection goes out of
my access point, never got disconnected or anythings else...
also never get reconnected when the AP becone available.
== Fourth setup: ==
I tryed SetWirelessSettings to force the reconnection to one of my acces
point, it work fine except that
the way the function seems to be impelemeted (in OpenNETCF 1.4) wipe out all
my prefered device and their
configuration. When i call the fallowing code, the wep key of *ALL* my
prefered access point are gone...
(MYACCESSPOINT doesn't get wep key but MYACCESPOINT2 does)
OpenNETCF.Net.AdapterCollection oCol = OpenNETCF.Net.Networking.GetAdapters();
foreach(OpenNETCF.Net.Adapter a in oCol)
{
if(a.IsWireless)
{
a.SetWirelessSettings("MYACCESSPOINT", true, (byte[])null);
a.RebindAdapter();
}
}
if I could fix theese two issue, this could be a nice solution:
- Retreive a way to get the wep key of the AP configured in the deveice
(settings)
- Find a way to SetWirelessSettings without mixed up all the AP configuration
==Conclusion ===========
Thanks a lot for your help,
please help me to get samples or full articles helping me
to demystify that, my deadlines are really short and have no clue where to
look anymore!
reconnect when a connection is available. The application is connected live
to a SQLServer 2000 and when i get a broken connection, It shoud display a
message to the user
"Network connection lost, Reconnect?" Ok = Try to connect to the network
(available configured AccessPoint) an perform operation
Cancel = discard operation an wait until user try again
(the message will loop until success or cancel)
The application is destinated to verry novice user and
should be the most transparent as possible... down want them to get to the
device settings...
I'have tryed many things and nothings seem to work!
What i'm doing wrong... is it my device?
Is i understand something wrong?
The pocket PC is a DELL AXIM
2 Wifi acces point (MYACCESSPOINT no WEP KEY and MYACCESSPOINT2 with WEP KEY)
developping in C# using Visual Studio 2003 Compact Framework 1.0 with latest
service pack.
When i start Internet explorer, it automaticaly connect one of my prefered
access point! I also notice that where i am doing test there is a lot of not
configured device (and should hide the connect to a new network wizard)
== First setup: ==
I configure both as prefered devices and connect to one acces point
- I write a simple apps that open a connection on a SQL server on the network
- I goes out of scope the two acces point
- I came back near the acces point and wait... (1 minute and more)
- Try to re open the connection an get an error like "server does not exists"
== Second setup: ==
I read a bit an try the fallowing (with OpenNETCF),
after the error "server does not exists" i call my function
TakeConnection() but the code never break... so never get connected.. ;o(
private void TakeConnection()
{
ConnectionManager oCon = new ConnectionManager();
foreach( DestinationInfo d in oInfo )
{
bool connected = false;
if(d.description == "work")
{
oCon.Connect(d.guid, true, ConnectionMode.Asynchronous);
while(!connected)
{
if(_oCon.Status != ConnectionStatus.Connected)
{
System.Threading.Thread.Sleep(1000);
continue;
}
connected = true;
}
}
}
}
== Third setup: ==
I keept a member instance of ConnectionManager
and call a function like DoConnection at the form initialisation. (same as
TakeConnection with the global member)
The function also register to events OnConnect, OnDisconnect,
OnConnectionFailed, OnConnectionStateChanged...
When i start the app, i got the OnConnect, but when connection goes out of
my access point, never got disconnected or anythings else...
also never get reconnected when the AP becone available.
== Fourth setup: ==
I tryed SetWirelessSettings to force the reconnection to one of my acces
point, it work fine except that
the way the function seems to be impelemeted (in OpenNETCF 1.4) wipe out all
my prefered device and their
configuration. When i call the fallowing code, the wep key of *ALL* my
prefered access point are gone...
(MYACCESSPOINT doesn't get wep key but MYACCESPOINT2 does)
OpenNETCF.Net.AdapterCollection oCol = OpenNETCF.Net.Networking.GetAdapters();
foreach(OpenNETCF.Net.Adapter a in oCol)
{
if(a.IsWireless)
{
a.SetWirelessSettings("MYACCESSPOINT", true, (byte[])null);
a.RebindAdapter();
}
}
if I could fix theese two issue, this could be a nice solution:
- Retreive a way to get the wep key of the AP configured in the deveice
(settings)
- Find a way to SetWirelessSettings without mixed up all the AP configuration
==Conclusion ===========
Thanks a lot for your help,
please help me to get samples or full articles helping me
to demystify that, my deadlines are really short and have no clue where to
look anymore!