Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect when network is connected at startup

Status
Not open for further replies.

cjtaylor

Programmer
Aug 12, 2001
69
US
Hello,

I have an app that needs to start after the LAN network is available when windows starts. Is there anyway to determine when the network is ready to go after windows has been started?

Thanks
Chris Taylor
 


Do a ping to a known adress in your network (the router f.i.)

If you want to do this outside your program do a ping to a file : ping 192.182.1.1 > c:\ping.txt and then search with grep for the text :
grep "Time-out" c:\ping.txt
if errorlevel 1 goto error
start here the application
:error

Wim Vanherp
Wim.Vanherp@belgacom.net
 
that may be fine if you are checking for a tcp/ip
connection. you could also us the clientsocket object
to check the connection. If you are accessing windows
networking I would guess you would have to use a netbeui
type connection. This I havent a clue. But I would imagine you would just attempt to connect with a socket or whatever and test return values. If you are using a socket you will be connecting to a server and if the server is not available you know the network connection is not up. You should have some error checking whenever you access the server anyway, just extend this to your situation.

In a nutshell, Just connect, if you cant, you cant.

tomcruz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top