Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Testing network status

8 views
Skip to first unread message

Greg Neill

unread,
Dec 12, 2011, 11:17:26 AM12/12/11
to
Is there a slick way in Power Basic to test the up/down status
of the network? This is PB_DOS in a Win2K environment.

Sure I can use SHELL to ping a site and drop the results into a
file, then read the file and check the result, but it seems like
a lot of overhead and I/O for such a trivial task. Suggestions?



Auric__

unread,
Dec 12, 2011, 2:40:23 PM12/12/11
to
Shell out to ipconfig? Untested air code:

function inetup() as integer
shell "ipconfig>tmp"
f = freefile
open "tmp" for input as f
for x = 1 to 8
line input #f, lookielookie
next x
close f
kill "tmp"
x = instr(lookielookie, ":")
myip = mid$(lookielookie, x + 2, 3)
inetup = (myip <> "168")
end function

This will probably need to be altered some to work properly. That "168" value
needs to be the subnet Windows uses when it's not connected. (I'm *fairly*
sure it's 168.x.x.x but it's been a *long* time since I've checked.)

--
- You and what six others?
- Me, myself, and a baseball bat.

Greg Neill

unread,
Dec 12, 2011, 4:45:05 PM12/12/11
to
Thanks for the reply. It gives me something to look into as
an alternative to the ping.

I was kind of hoping to avoid the file I/O altogether, but
perhaps its not to be.


Auric__

unread,
Dec 12, 2011, 9:10:54 PM12/12/11
to
Well, how are you doing whatever it is that requires network access? *That*
might give you some better hints than my air code. (I don't do DOS<->net
stuff myself.)

Also, what version of PB/DOS?

--
Can this thing go any faster, or will its rubber band snap?

Tom Lake

unread,
Dec 13, 2011, 2:07:55 AM12/13/11
to


"Greg Neill" wrote in message
news:yOpFq.55832$sp4....@unlimited.newshosting.com...
How about using ON ERROR GOTO and try a network access.
If the error path is followed, you have no network.

Tom L

Greg Neill

unread,
Dec 13, 2011, 11:17:50 AM12/13/11
to
Auric__ wrote:
>
> Well, how are you doing whatever it is that requires network access?
*That*
> might give you some better hints than my air code. (I don't do DOS<->net
> stuff myself.)
>
> Also, what version of PB/DOS?

PB/DOS 3.50.

There's no particular pre-existing application here. The background
is, my DSL connection has been experiencing random dropouts. The
modem drops its signal and goes into the re-acquire mode every now and
then. Before the modem actually drops and cycles the network can be
dead for some period of time. I don't know precisely how much time
because I don't notice it until I try to do something network related,
like use a browser, try to check email, or pull down USENET posts.
Once the modem decides to do its thing the cycle can take up to a
minute to get everything back to normal (It's annoying but not
terminal; I'm not doing anything that requires 100% network
connectivity).

The last time I reported the problem to my provider they were not
particularly helpful, suggesting that I turn off the DSL modem, wait
30 seconds, then turn it back on. The only way I could see this
being an effective "treatment" is if there were a defective modem
in a modem pool at the CO end so that cycling it this way might let
me grab a different connection (and pass the problem along to
someone else!). But I doubt that DSL connections work with modem
pools. They also stated that if they sent someone to look at the
problem that if they determined that no abnormal condition exists, a
healthy service charge would be levelled. So, shoddy service with
shoddy support. What a joy!

The idea of the BASIC program was to monitor the network and keep a
log of the ups and downs, perhaps see if there's a pattern to the
occurrences, and tally the total downtime. I figure the network
misbehaves when I'm not looking more than when I am. I plan to
find out what figure for percent availability turns the problem from
"within normal parameters and we'll charge you to make it better" to
"we'll send someone to fix it, no charge". The first step is to
collect some hard figures for reliability numbers.

Since the "events" are infrequent but of relatively short duration,
detecting them and timing them requires that whatever monitors them
be fairly "fine grained". That's why I'd like to avoid the disk I/O;
I don't want to exercise the disk and interfere with other ongoing
work on the machine if I can avoid it. Logging events when they
occur is an insignificant amount of I/O compared to spawning a shell
command (with its environment), writing its output to a file, reading
it in, and erasing the file every 5 or 20 seconds or so.

I was also hoping to avoid having to concoct a whole web client in
order to do this and if I did, it's certainly not something for which
I would choose PB/DOS for its implementation.

I think I'll prowl around a bit and see if there isn't something
already "in-the-can" that I can use or adapt.


Greg Neill

unread,
Dec 13, 2011, 11:22:48 AM12/13/11
to
Hi Tom. Thanks for the suggestion. I think I'll be looking at
other options besides using my creaky old PB/DOS 3.5 to do
actual network accesses. Maybe steal some code from another
application that I can bend to my will :-)


Peter Manders

unread,
Dec 13, 2011, 2:25:02 PM12/13/11
to
On Tue, 13 Dec 2011 11:17:50 -0500, "Greg Neill"
<gnei...@MOVEsympatico.ca> wrote:

>There's no particular pre-existing application here. The background
>is, my DSL connection has been experiencing random dropouts. The
>modem drops its signal and goes into the re-acquire mode every now and
>then.

You could check its power supply voltage. It tends to drift upward
over the years, so your reconnect problem might be solved by simply
replacing it.

And I'm sure there are some decent, free, network monitoring tools to
be found on the internet.
--
Peter Manders.

Wise men talk because they have something to say,
fools because they have to say something. (Plato)

Greg Neill

unread,
Dec 13, 2011, 2:43:59 PM12/13/11
to
Peter Manders wrote:
> On Tue, 13 Dec 2011 11:17:50 -0500, "Greg Neill"
> <gnei...@MOVEsympatico.ca> wrote:
>
>> There's no particular pre-existing application here. The background
>> is, my DSL connection has been experiencing random dropouts. The
>> modem drops its signal and goes into the re-acquire mode every now and
>> then.
>
> You could check its power supply voltage. It tends to drift upward
> over the years, so your reconnect problem might be solved by simply
> replacing it.

Could be. I'll look into that.

>
> And I'm sure there are some decent, free, network monitoring tools to
> be found on the internet.

I ended up writing a shell script (GNU bash) to do the
testing. No intermediate files required, the data is piped
from command to command to extract the required info. The
disk cache abates the re-loading of command images, so all's
good.





Auric__

unread,
Dec 13, 2011, 2:59:45 PM12/13/11
to
I *was* going to suggest a batch file to ping yahoo.com and save the
results for later comparison (rather than a PB solution, which isn't
needed in this case), but this site:
http://www.website-monitoring.org/website-monitoring-download.php

...already has a free thing to do exactly that. It gets its input from a
database, but lo! Observe my awesome VBScript skills! ...just kidding.

Option Explicit
Dim objWinHttp, benchmarksite, strHTMLNR, uptimenetready
benchmarksite = "http://www.yahoo.com/"
Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
On Error Resume Next
objWinHttp.Open "GET", benchmarksite
objWinHttp.Send
objWinHttp.WaitforResponse(10000)
strHTMLNR = objWinHttp.ResponseText
uptimenetready = objwinHttp.Status
If Err.Number <> 0 Then
WScript.Echo "Internet may be down! (Error number " & _
CStr(Err.Number) & ")"
End If
Set objWinHttp = Nothing

Save that to a file named something ending in ".vbs" and schedule it to
run, say, every minute. (If 2000 can't handle scheduling .vbs files, then
use "wscript.exe thisfile.vbs".)

(You can replace Yahoo with any site that's unlikely to go down.)

I can't *guarantee* that this is what you need, but it's what *I* would
try first. Once you get the error message popping up, do a traceroute to
yahoo.com (or wherever) so you can hopefully get some idea of where the
problem is. ("tracert yahoo.com>results.txt", let the traceroute complete.
The first machine to not reply *might* be the problem, but save
results.txt to compare against the *next* time internet goes down.)

--
You're complaining about grammar in spam?
Don't you have anything better to do?

Greg Neill

unread,
Dec 13, 2011, 6:10:20 PM12/13/11
to
Thanks. I may tinker with that.

Cheers,

-gneill


Auric__

unread,
Dec 13, 2011, 7:19:16 PM12/13/11
to
Np. It's GPL, btw. Forgot to mention, but since it's based on GPL code...

I noticed your post about hacking together something in bash. Just curious,
on a different machine? Or is bash available on the 2000 machine?

--
I'm going to make your skull cap into a soup bowl.

Greg Neill

unread,
Dec 14, 2011, 11:38:46 AM12/14/11
to
Auric__ wrote:
>
> Np. It's GPL, btw. Forgot to mention, but since it's based on GPL code...
>
> I noticed your post about hacking together something in bash. Just
curious,
> on a different machine? Or is bash available on the 2000 machine?

I did it on the Win2k machine. Many moons ago I installed a
bash shell environment for something I was doing at the time.

It's a pre-compiled version of the GNU Bash, made by Steve Kemp:

http://www.steve.org.uk/Software/bash/


Auric__

unread,
Dec 14, 2011, 4:02:26 PM12/14/11
to
I use what comes with Ch (a C-ish interpreter system, softintegration.com) --
I *think* it's from MinGW, but I'm not at home to check. Shrug.

--
Would that I could stop time and kill them ALL first.
0 new messages