[aprssig] Perl APRS IS
Andrew Rich
vk4tec at tech-software.net
Tue Sep 22 03:59:50 EDT 2009
Thanks
I am working on the time
linux-0b9b:/maint/scripts # ./iss_go32_watchdog.pl
MySQL = 2009-09-22 07:5
Compu = 2009-09-22 07:5
Match...
----------------------------------------------------------
Andrew Rich
Airways Technical Officer Grade 4
Surveillance - RADAR ADS-B
Amateur Radio Callsign VK4TEC
email: vk4tec at tech-software.net
web: www.tech-software.net
----- Original Message -----
From: "Heikki Hannikainen" <hessu at hes.iki.fi>
To: "TAPR APRS Mailing List" <aprssig at tapr.org>
Sent: Tuesday, September 22, 2009 5:56 PM
Subject: Re: [aprssig] Perl APRS IS
On Tue, 22 Sep 2009, Andrew Rich wrote:
> 3. The script will start, and then run but stay up - ie the telnet
> connection has gone stale
As a sidenote, if you're connecting to an APRS-IS server, it's not
actually a telnet connection (the telnet protocol is not used at all).
It's just a plain TCP connection.
> I am now looking at coding something based on the time and date of the
> APRS IS heartbeat every 40 seconds.
>
> Ideas on how to manage stale connections ?
>
> PERL does not seem to die on a stale connection - that is my issue
That's not a fault of Perl, or any other language.
The application could maybe send some data on the connection every now and
then (like a timestamp packet with a # in the beginning, much like what
you get from the APRS-IS server), so that the operating system's TCP stack
will figure out that the data does not get through, and the connection
needs to be closed. There's no way for the OS TCP stack to figure if (1)
the other end has nothing to send, or (2) if the other end is sending
something but it's not getting through.
The other alternative is making the application figure out that there's
nothing coming in for a certain time. Every time you get something, look
up the current time ($last_received = time();). Then, use non-blocking IO
on the TCP socket, and use the select() system call with a timeout. When
the select() returns and doesn't indicate that there would be anything to
receive on the socket, check if too much time has passed since the last
received complete packet, and consider closing the connection.
These instructions work for other programming languages, too.
- Hessu
--------------------------------------------------------------------------------
> _______________________________________________
> aprssig mailing list
> aprssig at tapr.org
> https://www.tapr.org/cgi-bin/mailman/listinfo/aprssig
>
--------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.13.112/2387 - Release Date: 09/21/09
17:55:00
More information about the aprssig
mailing list