Forums (http://www.elitetrader.com/vb/index.php)
- Backup and Security (http://www.elitetrader.com/vb/forumdisplay.php?forumid=52)
-- Looking for a connection monitor that tells you if your internet died (http://www.elitetrader.com/vb/showthread.php?threadid=213932)


Posted by Daal on 01-21-11 02:43 PM:

Looking for a connection monitor that tells you if your internet died

I tried a few connections monitors out there and they are graph based which doesn't help me much. I need to be able to tell if that internet went down(even if for only 1sec, if I'm reading I can't tell), in the graphs you cant distinguish between inactivity and periods where the connection died


Posted by feng456 on 01-21-11 02:48 PM:

u could try some sort of online game. those things are very sensitive to changes in connection.


Posted by PIPMAGIC66 on 01-21-11 02:54 PM:

1 sec give me a break


Posted by Arthur Deco on 01-21-11 03:09 PM:

Listen to online radio.


Posted by Daal on 01-21-11 03:12 PM:

It needs to be something passive that I just check the logs after. I will have to monitor everyday all day so any active solution is not optimal


Posted by hoodooman on 01-21-11 03:21 PM:

Quote tracker will tell you when you've lost the connection to your broker for whatever reason.


Posted by Pekelo on 01-21-11 03:37 PM:


Quote from Arthur Deco:

Listen to online radio.



Doesn't work because it is preloading, just like Youtube, so if there is a few seconds downtime, you won't notice it...

But here it is one:

http://www.connectionmonitor.net/

Or some others:

http://www.freedownloadmanager.org/...nitor_software/


Posted by atticus on 01-21-11 03:38 PM:

http://www.connectionmonitor.net/

http://www.pingdom.com/services/


Posted by LeeD on 01-21-11 03:56 PM:

The easiest way is to open the black command prompt window and type "ping myfavouritewebsite.com -t". You will immediately see the output format changing when connection drops. (The output doesn't keep a timestamp. So, you need something m,ore sophisticated if you want to see when connection dropped in the past.)


Posted by Steven.Davis on 01-21-11 04:08 PM:

I am unclear if you are looking for a GUI software to confirm what you are already seeing, or if you are looking for an SNMP/WMI programmatic indicator. As it happens, there are even events that ones program can subscribe to which identify losing and regaining local connectivity. In general, routers/teaming technologies commonly use a consensus of ping results from a variety of ping targets to determine which paths are functional.


Posted by Wallace on 01-21-11 08:06 PM:

I use 'NetWorx': http://www.softperfect.com/products/networx/
go to Settings/Notifications
and use this sound: http://soundbible.com/843-Intruder-Alert.html


Posted by Bernard111 on 01-23-11 11:45 AM:

Ping Plotter standard / Pro or Multiping. http://www.nessoft.com/products.html


Posted by fullautotrading on 01-24-11 10:38 AM:

Re: Looking for a connection monitor that tells you if your internet died


Quote from Daal:

I tried a few connections monitors out there and they are graph based which doesn't help me much. I need to be able to tell if that internet went down(even if for only 1sec, if I'm reading I can't tell), in the graphs you cant distinguish between inactivity and periods where the connection died



If you download either vb.net express or c#express, it takes about 10 seconds to do that.

Any winform application has infact , within the application events, built in, disconnect/reconnect event handler which is called on these events. There you can put simple code to do anything you like.

Tom


Posted by LeeD on 01-24-11 10:47 AM:

Re: Re: Looking for a connection monitor that tells you if your internet died


Quote from fullautotrading:

If you download either vb.net express or c#express, it takes about 10 seconds to do that.

Any winform application has infact , within the application events, built in, disconnect/reconnect event handler which is called on these events. There you can put simple code to do anything you like.

Tom

Except I understand it tracks LAN (or USB modem) connection. If you have a modem-router, there is no way the PC will know the cable from the modem-router to the the telephone exchange got cut... unless the PC constantly sends some requests that require such a connection.


Posted by fullautotrading on 01-24-11 03:20 PM:

Re: Re: Re: Looking for a connection monitor that tells you if your internet died


Quote from LeeD:

Except I understand it tracks LAN (or USB modem) connection. If you have a modem-router, there is no way the PC will know the cable from the modem-router to the the telephone exchange got cut... unless the PC constantly sends some requests that require such a connection.



hmmm, i am not sure what you mean. It seems to me that it correctly monitors any internet disconnection, reconnection...

You find it in: Application Properties > Wiew Application Events

Event: NetworkAvailabilityChanged
Property: e.IsNetworkAvailable

Tom


Posted by Steven.Davis on 01-24-11 04:43 PM:

Re: Re: Re: Re: Looking for a connection monitor that tells you if your internet died


Quote from fullautotrading:

hmmm, i am not sure what you mean. It seems to me that it correctly monitors any internet disconnection, reconnection...

You find it in: Application Properties > Wiew Application Events

Event: NetworkAvailabilityChanged
Property: e.IsNetworkAvailable

Tom


I have done extensive network redundancy testing for our colocation environment. This included Windows 7 and Windows 2008. For both of these environments, the NetworkAvailabilityChanged event will fire on a failure in the cable or first switch. Failure of any switch or connection passed this point do not fire the NetworkAvailabilityChanged event. I have only ever seen Windows realize that there was a problem upstream if there was an actual TCP session running/opening. There is multi-gateway logic in Windows 2008 (7 as well I think), but the failover logic depends upon failed TCP connections. We had to use ICMP-ping packets and custom logic.


Posted by fullautotrading on 01-24-11 04:50 PM:

Re: Re: Re: Re: Re: Looking for a connection monitor that tells you if your internet died


Quote from Steven.Davis:

I have done extensive network redundancy testing for our colocation environment. This included Windows 7 and Windows 2008. For both of these environments, the NetworkAvailabilityChanged event will fire on a failure in the cable or first switch. Failure of any switch or connection passed this point do not fire the NetworkAvailabilityChanged event. I have only ever seen Windows realize that there was a problem upstream if there was an actual TCP session running/opening. There is multi-gateway logic in Windows 2008 (7 as well I think), but the failover logic depends upon failed TCP connections. We had to use ICMP-ping packets and custom logic.



Thanks, that is good to know. I guess that for the use the OP intended it could be fine. Or else, there are other instruments within the language which can be useful. For instance:

My.Computer.Network.Ping() and many others ...

I guess for more complex checks one could create create a simple monitor which fired every whatever interval ... it's a just a very few lines of code.

Tom


Posted by Daal on 01-24-11 04:53 PM:

I'm using the cmd ping utility from windows, its not capturing the internet fluctuation that was the problem, guess my internet never died, it just fluctuates like crazy. The main problem is me missing hands from the pokerstars client when my internet goes idle for a while.

I'm buying a good wireless antenna and will use that instead of the built-in one


Posted by LeeD on 01-24-11 04:57 PM:


Quote from Daal:

I'm buying a good wireless antenna and will use that instead of the built-in one

wireless is not super-stable by design. a neighbour switches on a microwave and you may loose connection for fraction of a second. have you tried ethernet cable instead?


Posted by fullautotrading on 01-24-11 05:07 PM:


Quote from Daal:

I'm using the cmd ping utility from windows, its not capturing the internet fluctuation that was the problem, guess my internet never died, it just fluctuates like crazy. The main problem is me missing hands from the pokerstars client when my internet goes idle for a while.

I'm buying a good wireless antenna and will use that instead of the built-in one



that's another matter. Consider changing provider ;-))

Anyway in theme of checks, whenever ping might not work (it might), i have seen recommending on the web also these approaches:

{
System.Net.IPHostEntry objIPHE = System.Net.Dns.GetHostEntry("www.google.com");
}
catch
{
MessageBox.Show ("...No Conn...");
}



bool ConnectionExists()
{
try
{
System.Net.Sockets.TcpClient clnt=new System.Net.Sockets.TcpClient("www.google.com",80);
clnt.Close();
return true;
}
catch(System.Exception ex)
{
return false;
}
}


might give them a try ... let us know in case ...


Tom


Posted by Daal on 01-24-11 05:09 PM:


Quote from LeeD:

wireless is not super-stable by design. a neighbour switches on a microwave and you may loose connection for fraction of a second. have you tried ethernet cable instead?



Not an option, its the wireless internet offered by the building I live


Posted by Steven.Davis on 01-24-11 05:26 PM:


Quote from fullautotrading:


try
{
System.Net.Sockets.TcpClient clnt=new System.Net.Sockets.TcpClient("www.google.com",80);
clnt.Close();
return true;
}
catch(System.Exception ex)
{
return false;
}
}


Opening a TCP connection to see if it connects is sometimes referred to as a TCP-ping.

A word of caution about TCP-pings. Some servers, such as MySQL, keep track of failed authentication attempts. Remember that from the server's point of view, it accepted the socket and began the authentication protocol which was not successfully completed. A client which repeatedly consumes server resources without successful authentication is, by some servers, treated as a Denial-Of-Service attacker and banned.

It was a real surprise when seemingly random servers objects were no longer able to connect to any of the MySQL servers after my custom network monitoring tool had been upgraded for a few days.

In addition to the methods previously mentioned, there are services on the Internet which will ping your address from several networks, and give you notification/detailed reporting. This can be useful since your server may not be able to notify you that it has lost connectivity. I was able to add monitors on employee's home networks to help with this, but usually a reported outage was due to the employee's network.

Good Luck with it.


Posted by omti on 01-26-11 04:16 PM:

I had the same issue - I have several computers that needs to communicate to a host Server. So I wrote a cmd file which uses the ping -t and tracert (if wanted) and captures the results to a txt file with date and time. I wanted to be able to run the capture from the host server for all my computers, and forget it. I downloaded forfiles.exe from the windows resource kit (google forfiles.exe download), and added a line in the script that deletes old logs to prevent the hard drive from filling up down the road. I've been running this script for several months and works like a champ.

To create the cmd file. Copy and paste the below script into notepad, and save it any name you want, with a .cmd ext. (example is Ping_Capture.cmd). Make a folder C:\Ping_Test and save the file there (unless you modify the script to run from a different folder)

A couple of things to look for. Make sure forfiles.exe is your path (I copied it to the windows\system32 folder), and make sure the cmd file ends with .cmd and not .txt. I had to go to a command window and rename it.

Doubleclick the script and it prompt for
- the IP address or Host name you want to ping (google.com)
- folder name (don't put in a path - just the name (Google)
- how many days to keep the logs
- include Traceert in the logs (Y/N)

Then a screen will show the details about the running script. Go to the log files and open them up in notepad.

----------------

@echo off

Rem This script needs to be ran from C:\Ping_Test, unless the script is modified.
Rem The script does a tracert, 500 pings and everyday deletes old log files.
Rem Creates a new log file every hour, in a date folder

Cls
Echo.
Echo.
Setlocal

Set _IP_Address=
Set _Fld_Name=
Set _Log_Limit=
Set _Tracert=
set _tr=

:IP
Set /P _IP_Address=Enter IP address or Host Name:
IF ERRORLEVEL 1 GOTO IP
:Fdr
Set /P _Fld_Name=Enter Folder Name:
IF ERRORLEVEL 1 GOTO Fdr
:log
Set /P _Log_Limit=Enter how many days to keep logs:
IF ERRORLEVEL 1 GOTO Log
:Trc
Set /P _Tracert=Inclued Tracert in Logs (Y/N) :
IF ERRORLEVEL 1 GOTO Trc
Set _logpath=c:\ping_test\Logs\%_Fld_Name%

echo %_Tracert%| find /i "Y" >NUL && set _tr=is
echo %_Tracert%| find /i "N" >NUL && set _tr=is not
if "%_tr%" == "" (set _tr=is not)
if not %_log_Limit% LEQ 100 set _log_Limit=1
for /F "tokens=2-4 delims=/- " %%c in ('date/T') do set _today=%%c-%%d-%%e

cls
Echo.
Echo.
Echo ******************************************************************
Echo.
Echo. Script started on %_today% at %Time%
Echo. Ping Capture for %_IP_Address%
Echo. Logs are located at c:\ping_test\Logs\%_Fld_Name%
Echo. Logs will be kept for %_Log_Limit% Day(s)
Echo. Trace Route %_tr% included in the logs
Echo.
Echo. CTL-C to stop the script
Echo.
Echo ******************************************************************

:Start

for /F %%a in ('Date /t') do (For /F "delims=/" %%b in ("%%a") do set _pday=%%b)
for /F "tokens=2-4 delims=/- " %%c in ('date/T') do set _today=%%c-%%d-%%e
for /F "tokens=1 delims=:" %%h in ('time /t') do set _Hour=%%h
for /F "tokens=2 delims=:" %%m in ('time /t') do set _min=%%m
echo %_min%| find /i "AM" >NUL && set _AmPm=AM
echo %_min%| find /i "PM" >NUL && set _AmPm=PM

if not exist "%_logpath%\%_today% %_pday%" md "%_logpath%\%_today% %_pday%"
Set _logfile="%_logpath%\%_today% %_pday%\%_Fld_Name%-%_hour%-%_AmPm%.txt"
Set _D=Date: %_today%
Set _T=Time: %Time%

echo %_D% >> %_logfile%
echo %_T% >> %_logfile%

If /i NOT %_Tracert% == Y goto :Ping

tracert %_IP_Address% >> %_logfile%

:Ping
ping %_IP_Address% -n 500 >> %_logfile%
echo ----------------------------------------------------------- >> %_logfile%

for /F "tokens=2-4 delims=/- " %%c in ('date/T') do set _date=%%c-%%d-%%e

If NOT ("%_today%") == ("%_Date%") goto Cleanup

:Cleanup

ForFiles /P "%_logpath%" /d -%_Log_Limit% /C "CMD /C if @isdir==TRUE /Q /S @FILE &RD /Q /S @FILE" 2>Nul

goto start


Posted by Steven.Davis on 01-26-11 09:27 PM:

Nothing against, good old cmd or powershell, but I usually write such maintenance scripts in Perl or VBScript(cscript). Perl makes it very easy to do list and date comparisons. VBScript is good if you want to get at performance metrics.


All times are GMT. The time now is 11:12 AM.

Copyright © 2012 Elite Trader.