How to check periodically for internet connection using console application? It must work on both Dial-up and LAN. So it would be probably an ping or something like this? Plese if you have some code snippet it will help me. i am absolute beginner in MASM. Thank you. Michal.
Posted on 2000-11-09 16:02:00 by Raguru
what about checking the users IP? if it's not then he's connected right?
Posted on 2000-11-10 07:54:00 by Hiroshimator
Not really true - (.1 not .0) will be your IP if you have the situation where you have, say, no network cards etc. In my case I have a network card and the internet conn, so I get and a 192.168.x.x address for my local and then get the internet addr... ping probably not a bad idea. Search through .asm webrings and sites for some winsock eg. on this OR maybe just try to resolve a known DNS to a IP and if it works you probably got a internet link somewhere (use the resolve winsock command) James
Posted on 2000-11-10 21:29:00 by james
I have got some application yet. It starts checks for conn and close it self. But i need some messageloop or something to do it PERIODICALLY. That is the point. I would sen you my source for you to implement that loop or timer or something because I am not so good to do it. Raguru.
Posted on 2000-11-11 06:56:00 by Raguru
thanks, I'm not a network hero :) why don't you use a timer?
Posted on 2000-11-13 06:36:00 by Hiroshimator
You can use: InternetGetConnectedState its in WININET.DLL ... search info on MSDN
Posted on 2000-11-13 09:44:00 by unknow this is a VB example that works well it queries for a registry key that windows sets when you have a net connection.
Posted on 2000-11-13 14:29:00 by Hiroshimator
You'll probably need to use a combination of InternetGetConnectedState() and ping. The reason for this is that InternetGetConnectedState() only reports information on dialup or LAN connection if the user has set the annoying auto-connect thing properly. If however the user is on dial-up and has set the Always Connected (LAN) option the above function will always return connected when the system isn't, so first check for a connection and then verify with a ping (do a few though because unless you know where the guy is you won't know if he's connected but a servers unreachable, etc.. )
Posted on 2000-11-19 15:01:00 by soljnr
InternetGetConnectedState returns the method by which the computer is connected: INTERNET_CONNECTION_MODEM Local system uses a modem to connect to the Internet. INTERNET_CONNECTION_LAN Local system uses a local area network to connect to the Internet. INTERNET_CONNECTION_PROXY Local system uses a proxy server to connect to the Internet. INTERNET_CONNECTION_MODEM_BUSY Local system's modem is busy with a non-Internet connection. So now it's pretty obvious if it returns LAN connection then you can check something, but you could start accessing the internet immediately anyhow so you don't really need to check anything just connect. See ya, Ben
Posted on 2000-11-28 23:02:00 by cyberben