[RESOLVED] detecting wireless disconnected
Hello,
I am doing development for a windows mobile device using Visual Basic 2005.
The customer want to be able to download the data from the main database and be able to work off-line.
So I have decided that all the data that is download will be written to a xml file that can be read by a dataset. Also use the dataset to write changes.
When the user goes online the changes they have made to the off-line xml file will need to update the SQL database, I will use the getChanges of the dataset to sync with the central database (SQL Server 2005)
However, the user will be using a wireless and I will need a condition in my code that will detect if the wireless gets disconnected so that they can use the off-line data in the xml file that can be read in by the dataset.
I am not sure how I would detect the wireless being disconnected, as this will disconnect from the sql server database?
Any advice would be most helpfull,
Many thanks,
Steve
Re: detecting wireless disconnected
Is the data so small that XML is a good choice on the PPC?
We use MS SQL CE - a stripped down version of SQL for mobile apps.
As for detecting your connection lost - I'm not really sure how you would go about that. I would imagine you would simply get an EXCEPTION thrown when the connection disappears.
Re: detecting wireless disconnected
Hi,
take a look at Sql CE and replication - it rocks. Replicate the tables you need, do the data collection to a Sql CE database on the device, and then relplicate again to put back the collected data.
For detecting loss of connection - look at your IP address - if it is 127.0.0.1 then you are not connected.
Code:
Public Function Connected_To_Network() As Boolean
LocalEndpoint = New IPEndPoint(Dns.GetHostEntry(Dns.GetHostName()).AddressList(0), 0)
Try
If localEndPoint.Address.ToString = "127.0.0.1" Then
localEndPoint = Nothing
Return False
Else
localEndPoint = Nothing
Return True
End If
Catch ex As Exception
Return False
End Try
End Function