mIRC Home    About    Download    Register    News    Help

Print Thread
$isconn Identifier #90998 19/07/04 05:10 PM
Joined: Apr 2004
Posts: 66
C
Cyrex Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Apr 2004
Posts: 66
How about adding an identifier called $isconn? This would return $true if you are connected to the internet, and $false if you are not.

Re: $isconn Identifier #90999 22/07/04 10:26 AM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
If you're talking about "connected to the internet" via a dialup account and you're using WinNT.
Code:
isconn {
  var %a = $ticks
  .comopen %a WScript.Shell
  if !$comerr { .comclose %a $com(%a,Run,3,bstr,cmd /c rasdial|find "Connected to">ras.txt,uint,0,bool,true) }
[color:gray]  ; check the size of ras.txt
  ; if a connection was found it will contain Connected to
  ; if no connection was found it will be empty[/color]
  var %a = $file(ras.txt)
  .remove ras.txt
[color:gray]  ; return the value of %a, if it is zero you are not connected[/color]
  return %a
}

Re: $isconn Identifier #91000 22/07/04 04:34 PM
Joined: Apr 2004
Posts: 66
C
Cyrex Offline OP
Babel fish
OP Offline
Babel fish
C
Joined: Apr 2004
Posts: 66
Actually, I was talking about an I identifier that would work on connections other than just Dial-up. I know for a fact this is possible, because I've seen source code for it in other programming languages that check if all types of connections are connected to the internet. The code you posted is just limited to Dial-up connections, so it would be useless to non Dial-up users. And just because someone is using broadband doesn't always mean they are connected to the internet. Their ISP could be experiencing problems, so the user would not be connected to the internet. This is where the $isconn identifier comes in handy.

Re: $isconn Identifier #91001 24/07/04 08:51 PM
Joined: Feb 2004
Posts: 201
J
Jae Offline
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2004
Posts: 201
There's always a traceroute.... if u can do one to ure isp's homepage.. (which yesi know you have to get ..) but maybe somethin similar may work..