Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to detect lost internet connection ?

How to detect lost internet connection ?

Scheduled Pinned Locked Moved Visual Basic
csharpsysadminlinuxtutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cheeken2u
    wrote on last edited by
    #1

    my VB.net application uploads local files to server. Every second my application need to detect whether my application still connected to that server or lost connection, how i can detect the connection lost or still connected ? using shell or ping ? how to use it ?

    Regards, Chee ken

    V S 2 Replies Last reply
    0
    • C cheeken2u

      my VB.net application uploads local files to server. Every second my application need to detect whether my application still connected to that server or lost connection, how i can detect the connection lost or still connected ? using shell or ping ? how to use it ?

      Regards, Chee ken

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      hi Try this http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=215689&SiteID=1[^] Hope it Helps

      Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za

      1 Reply Last reply
      0
      • C cheeken2u

        my VB.net application uploads local files to server. Every second my application need to detect whether my application still connected to that server or lost connection, how i can detect the connection lost or still connected ? using shell or ping ? how to use it ?

        Regards, Chee ken

        S Offline
        S Offline
        Steven J Jowett
        wrote on last edited by
        #3

        firstly I would not check the connection every second, I would only check it just before I upload the file. I use a function like the following to check if a connection exists :- Public Shared Function IsWebSiteAvailable(ByVal Address As String) As Boolean Try Dim oUrl As New System.Uri(Address) Dim oWebRequest As System.Net.WebRequest = System.Net.WebRequest.Create(oUrl) Dim oResponse As System.Net.WebResponse = oWebRequest.GetResponse oResponse.Close() oWebRequest = Nothing Return True Catch Return False End Try End Function There I would the code the upload as follows If IsWebSiteAvailable("www.mysite.com") Then DoUpload() Else MessageBox.Show("Internet connection unavailable.") End If

        Steve Jowett ------------------------- Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups