Results 1 to 3 of 3

Thread: VB6 - Clean Ping in VB6 Code

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Arrow VB6 - Clean Ping in VB6 Code

    Here is version 2 of my PingIPv4.bas module. Version 1 was a little too feature-poor for publication.

    There is a Ping() function that you pass an IP address string value to. There are optional arguments to set a non-default timeout in milliseconds or a string to be echoed as part of a larger payload. By default the timeout is 1000 and the data string is "".

    In case you need name resolution you can call the helper function Resolve(). You pass a string containing either an IP address or network name (DNS, Hosts file, WINS, etc. host names) and it returns the IP adress string in the second argument. Then this "converted" string can be used with Ping() calls.


    You can use this as-is, delete parts you don't need, expand upon it further, etc. (see the comments). You could also convert it to a Class which makes the code dynamic (i.e. if you only need to ping on occasion your program won't carry the baggage of a static module for its entire lifetime).

    Tested on Windows 95 OSR2, Windows XP SP3, Windows Vista SP2, and Windows 7 SP1.

    Atached here as part of a working demo Project.


    While there is another example posted here somewhere it is pretty old and crusty. It also appears to have been hastily created from some really, really raggedy VB4 code he found somewhere.
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width