INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Internet Connection

How to know if user is connected by craigsboyd
Posted: 16 Mar 04

This is one of the most reliable ways to do this.  Some other methods can provide erroneous results if the user's machine is hooked up to a network.  You can replace the IP I have used with one of your own, especially if the reason you are checking the connection is to see if the user can get to your FTP site of Website you should use that IP instead, because sometimes you not only want to know if the user has an internet connection but also can they get to your site.

CODE

DECLARE INTEGER GetRTTAndHopCount IN Iphlpapi;
    INTEGER DestIpAddress, LONG @HopCount,;
    INTEGER MaxHops, LONG @RTT

DECLARE INTEGER inet_addr IN ws2_32 STRING cp

LOCAL lnDst, lnHop, lnRTT
lnDst = inet_addr("216.109.117.108") && Yahoo IP, replace with your own IP address if you don't want reliance on yahoo
STORE 0 TO lnHop, lnRTT

IF GetRTTAndHopCount(lnDst, @lnHop, 50, @lnRTT) = 0
    MESSAGEBOX("You are not currently connected to the internet.")
ELSE
    MESSAGEBOX("You are connected to the internet.")
ENDIF
CLEAR DLLS GetRTTAndHopCount, inet_addr

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close