D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] ppp dial on demand & timouts



On Monday 27 May 2002 11:39 am, andy@xxxxxxxxxxxxxxxxxxxxxx wrote:
Hi all,

here's today's challenge (got squid working by the way, thanks) ....

I use ppp and a chat script to connect my dialup modem to the internet
I've got it set up to dial on demand ....

... I open my browser ....
... my modem dials and chat starts to log in ....
... my browser times out ....
... chat finishes logging in ....
... I have to restart my browser ....
... everything now works as normal.

I use a variety of script techniques using PHP. Basically, if the SERVER 
fails to find the internet connection, that's fine. If the browser fails, it 
can screw up the browser. 

Enter this using vi etc:
<html><head>
<meta http-equiv="refresh" content="120">
<?php
if ($fp=@xxxxx("http://www.someserver/page/etc",r)) {
fclose($fp);
}
?>
</head>
<body>
Trying to connect</body>
</html>

Change the remote file location to match something that doesn't change often. 
(You don't have to specify the full page, the main URL will do.)

Save it as a PHP file. (Hopefully you've got PHP running as a module of 
Apache.) Every two minutes that this file is displayed in the browser, it 
will check for an internet connection without causing problems with the 
browser session. (Using galeon or Opera, this can act as a 'keep-online' 
script too - leave it displayed and it will stop ppp timing out and dropping 
the connection - while the tabbed galeon interface allows you to carry on 
surfing in the same browser session.)

Similar techniques could be used with other script languages that can open 
remote files. (Not sure if bash will do it.) It may be possible in Javascript 
although it may not solve the browser problems as Javascript doesn't run on a 
third party.

I don't know whether bash has this capability, but Python probably does and 
Perl certainly does, just I haven't written a script for that in Perl! IT 
could be done as a CGI script that would work just like the PHP above, 
providing you have Apache running. If you haven't got Apache running, or PHP 
installed, bash could run a perl script to do the job. Let me know and I'll 
try one. You'd have to start this separately from the browser though.


is there any way to get ppp/chat to give dummy replies to keep everything
that requests internet pages happy and stop them timing out

That works in reverse (keep-open scripts) but the browser will still time out 
if it doesn't get a complete page. 
q
cheers

Andy Weir

-- 

Neil Williams

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly