Code for Ping Request from your VB Application

Code block written below is used  check whether PC is currently in Network or not using Network.IsAvailable. If PC is in network then it will make Ping Request to specific PC.
In below example mPingURL is a variable which is holding IP Address or Name of PC within Network.


If My.Computer.Network.IsAvailable Then
   If My.Computer.Network.Ping(mPingURL, 20) Then
          foo = True
   Else
          foo = False
          Threading.Thread.Sleep(500)
          MsgBox("Constant Internet access is required, currently the Internet not available to access " & mPingURL)
                        

   End If

Else
   foo = False
   MsgBox("Constant Internet access is required, currently no Network is available to access the Internet")
                    
End If

Comments

Popular posts from this blog

SaveSetting and GetSetting in C#