Results 1 to 3 of 3

Thread: [RESOLVED] detecting wireless disconnected

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    Resolved [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
    steve

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    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.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width