Home - Watched Topics - FAQ - Member List - Groups - Edit Profile - Search - Slot Machine - Drawing - Play Flash Games


Login to Disable the Ads

Login or Click Here to Register
Username:    Password:      Log me on automatically each visit    
 Log in to check your private messages  -  Log in
Ping computers in VB.net
 
Post new topic   Reply to topic    Heroes of Gaming Forum Index -> General Discussion -> Script Guides
Author Message
Jaymzanator
Rookie
Rookie


Joined: 04 Aug 2006
Posts: 20
Location: my desk

303.09 Bronze Chips
0.00 Silver Chips
0.00 Gold Chips

PostPosted: Sun Dec 24, 2006 8:52 am    Post subject: Ping computers in VB.net Reply with quote

Ok, this can be quite handy if you are writing a chat client or a game server,
It can be used to determine if a Remote Computer is Available in Visual Basic

You can use the My.Computer.Network.Ping Method to determine whether a remote computer or host is available. The server can be specified by URL, computer name, or IP address. Do not include http:// when specifying a URL.

The Ping method is not a fail-safe method for determining the availability of a remote computer: the ping port on the target machine may be turned off, or the ping request may be blocked by a firewall or router.

Note
The options available in dialog boxes, and the names and locations of menu commands you see, might differ from what is described in Help, depending on your active settings or edition. This Help page was written with General Development Settings in mind. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.


To ping a server
Determine whether the Ping method returns True. This example reports whether or not the server can be pinged, by determining whether the Ping method returned True. Replace 198.01.01.01 with the IP address, URL, or computer name of the server to ping



Code:
If My.Computer.Network.Ping("198.01.01.01") Then
  MsgBox("Server pinged successfully.")
Else
  MsgBox("Ping request timed out.")
End If


To ping a server and specify a time-out
Determine whether the Ping method returns True, specifying the time-out interval in milliseconds. If no time-out is specified, 500 is used as the default. This example reports whether or not the server can be pinged, by determining whether the Ping method returned True, and it specifies a time-out interval of 1000 milliseconds. Replace www.jaymzanator.com with the IP address, URL, or computer name of the server to ping.


Code:
If My.Computer.Network.Ping("www.jaymzanator.com", 1000) Then
  MsgBox("Server pinged successfully.")
Else
  MsgBox("Ping request timed out.")
End If
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Heroes of Gaming Forum Index -> Script Guides All times are GMT - 8 Hours
Page 1 of 1

 



HeroesOfGaming.com | Cheat Codes | Shop | Calendar | Forum RPG | Flash Arcade Games | Bets

web counter   © 2005-2006 HeroesOfGaming.com / Powered by phpBB © 2001, 2005 phpBB Group / RSS Feed RSS Site Feed


Help Us Grow!