I'm trying to use this ping class, but I have no idea how to set it up. I added it as a class, and the function is public, but I cannot call it on my form like I could in VB6. How do I use this class to ping a host or ip address?
Alright, here is some other code that seems a bit more promising as it tries to duplicate the ping command built into windows. It doesn't quite work and I'm trying to figure out why. It was originally written in C# but was converted to VB.Net using the Microsoft C# to VB.Net converter. After some other modifications I was able to get the program to compile without any errors. You can view the code here.
I'm getting this error under the "Serialize" function:
An unhandled exception of type 'System.ArgumentException' occurred in Ping.exe
Additional information: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
That line really makes no sense since it's trying to stuff 32 bytes of data into a 33 byte array starting at index 14? I'm guessing something is missing somewhere else, or something didn't get converted.
I'm calling the function like this:
VB Code:
Dim a As New clsPing
a.PingHost("10.10.20.12", 32, 4, 2000)
Any help in figuring this out would be greatly appreciated.
Their IP* Works solution has been a god-send for me at work. I use it to ping clients on our network, run remote commands on our UNIX boxes etc, all from my VB .NET app.
Well, this isn't a top priority project (hence the sporatic posts), so there's no way I'd pay for this. Besides, it seems like there isn't any good VB.Net source for this. I would think this would be beneficial not only for myself, but for the community.
If someone has come across a working piece of code, please point it out! Thanks.
Am hoping someone might be able to shed some light on this, as I would also like to be able to ping.
Have copied ping.zip code into my project. And it works
I do
VB Code:
Dim a As New clsPing
a.Host = "10.0.0.129"
Dim b As Long = a.Ping()
MsgBox(b)
And it works once, but if Itry pinging the same ip again I just get 0.
Anyone know whats wrong with the code, or any better ways to ping.
Oliver1 - for the life of me I cannot figure this one out. I've looked all over the web for something that works and I cannot find anything. But that was a while ago and maybe something else has showed up now? If you do find anything on it please post it here.
I'm trying to use this ping class, but I have no idea how to set it up. I added it as a class, and the function is public, but I cannot call it on my form like I could in VB6. How do I use this class to ping a host or ip address?
I know this is an old thread, but I was looking for a class like this. I've corrected/modified the code...
Re: [RESOLVED] [02/03] How do I use this PING class?
You can also check out my codebank for "Automate Command Prompt and Redirect Output to Application", and just call ping from there, without even opening a command window, and have the result text available to you in your application...