473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to ping another computer in Vb.net 2003

Its easy in 2005 but I'm stuck with 2003 for now

Can anyone provide a snippet of code?
Thanks for any help.
Bob
Jan 7 '07 #1
5 8444
Robert.

if it's not built in then you probably need to use API check out the
IPHLPAPI.DLL (IP helper API)

it has alot of the IGMP protocol stuff in it.

Michael.
"Robert Dufour" <bd*****@sgiims.comwrote in message
news:Oh**************@TK2MSFTNGP02.phx.gbl...
Its easy in 2005 but I'm stuck with 2003 for now

Can anyone provide a snippet of code?
Thanks for any help.
Bob

Jan 7 '07 #2
When I had to do it in 2003, I just used an external program called
fping.exe and read back it's output.

"Robert Dufour" <bd*****@sgiims.comwrote in message
news:Oh**************@TK2MSFTNGP02.phx.gbl...
Its easy in 2005 but I'm stuck with 2003 for now

Can anyone provide a snippet of code?
Thanks for any help.
Bob

Jan 7 '07 #3
You can use WMI (add referrence/import to system.management)

Dim objPing As New SelectQuery("SELECT StatusCode FROM Win32_PingStatus
where address='" & machinename_or_ipaddress & "'")
Dim objSearch as New ManagementObjectSearcher(objPing)
Dim PingStatus As String = ""
For Each objItem as In objSearch.Get()
PingStatus = objItem("StatusCode").ToString
Next
if PingStatus <"0" Then
' failed
else
'success
end if

HTH,

Phil
"Robert Dufour" wrote:
Its easy in 2005 but I'm stuck with 2003 for now

Can anyone provide a snippet of code?
Thanks for any help.
Bob
Jan 7 '07 #4
You can forever use the application start.

\\\
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.UseShellExecute = False
pi.RedirectStandardOutput = True
pi.Arguments = "www.google.com"
pi.WorkingDirectory = "C:\windows\system32"
'this for nt* computers
pi.FileName = "ping"
p.StartInfo = pi
p.StartInfo = pi
p.Start()
Dim sr As IO.StreamReader = p.StandardOutput
Dim sb As New System.Text.StringBuilder("")
Dim input As Integer = sr.Read
Do Until input = -1
sb.Append(ChrW(input))
input = sr.Read
Loop
MessageBox.Show(sb.ToString)
///

Cor
Jan 8 '07 #5
Thank you folks, been a great help.
Bob
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:ep*************@TK2MSFTNGP02.phx.gbl...
You can forever use the application start.

\\\
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.UseShellExecute = False
pi.RedirectStandardOutput = True
pi.Arguments = "www.google.com"
pi.WorkingDirectory = "C:\windows\system32"
'this for nt* computers
pi.FileName = "ping"
p.StartInfo = pi
p.StartInfo = pi
p.Start()
Dim sr As IO.StreamReader = p.StandardOutput
Dim sb As New System.Text.StringBuilder("")
Dim input As Integer = sr.Read
Do Until input = -1
sb.Append(ChrW(input))
input = sr.Read
Loop
MessageBox.Show(sb.ToString)
///

Cor

Jan 8 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: DCK | last post by:
Hello :) Into group-archive i found most e-mails, which touches PINGing. In my work i've used TELNET for testing if host is operational. Sometimes, for unknown reasons, workstation doesn't...
5
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
Hi, All, I try to ping another PC using ping in vb 2005, can anyone provide a snippet of code? Thanks in advance, Martin
2
by: adnanahmed714 | last post by:
hi 1) i am using a home network consisting of two computer.on One pc i have Marvell Lan card(built-in on the board) and on the second pc i have BayLan network adapter. What i know if two pc's...
4
by: =?Utf-8?B?QWxleCBLLg==?= | last post by:
Hi all I need a simple program that allows me to check if an IP address is pingable. I am not going to send/receive anything to the remote host, just check if it is visible. Something like...
2
by: airwot4 | last post by:
I've been using ADSI to lookup a complete hostname from active directory from a partial as part of a script. It goes something like: Retrieve partial hostname from excel spreadsheet -...
6
by: Dave Marden | last post by:
I currently use this routine in vbscript to ping computers and get the status of ping to determine whether to try to backup a machine, I am trying to change it to work with vb2003.net I am...
3
by: SyGC | last post by:
Hi People, Im trying to do a simple Loop where by an IP address is pinged (Using My.computer.network.ping) and the results, true or false, are used to invoke another line of code. Basically if...
0
by: SyGC | last post by:
Hi Guys, I have used Threading for Network.Ping to continuously ping an IP address if ping is successful Image A is displayed if not Image B. The code is as follows: Imports System Imports...
4
by: Newbie | last post by:
Is it possible, without any 3rd party tools to simply ping an ip address, and get back if the ping was sucessfull. Thanks
6
by: belias | last post by:
So...here we go. I'm having an issue with one computer on a network not being able to ping other computers by name. I've spent the last day searching similar issues and I've tried all the steps...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.