Problem solve Get help with specific problems with your technologies, process and projects.

What's an easy way to ping an IP address with VB.NET?

How do you ping an IP address using VB.NET without writing 200 lines of code?
While it's probably much better if you write the ping code yourself so you can control exactly how you do the ping, there's nothing stopping you from spawning off the PING.EXE program that comes with Windows itself to do the work.

In a quick experiment on Windows XP, PING.EXE returns an error code of 1 if the host does not respond. If the host responds, PING.EXE returns 0. That's one quick and dirty way to do the work.

Of course, if there are security issues or you are running as a Win32 Service, you may not be able to start programs from your application, so you'll have to handle that situation yourself. As I said at first, I still think you'd be much better off doing the work to code up the ping operation yourself.

Dig Deeper on Visual Basic 6 programming language

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.