From 3aa003a1fcb299c9e116ec401cfed039fd4a9005 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 30 Jun 2009 00:07:24 -0500 Subject: actually, the ping has to be 40-239 codes 0-39 are taken by options, and codes 240-255 are taken by the actual protocol --- lib/IO/Socket/Telnet/HalfDuplex.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/IO/Socket/Telnet/HalfDuplex.pm b/lib/IO/Socket/Telnet/HalfDuplex.pm index 4cd7c0c..7e108a5 100644 --- a/lib/IO/Socket/Telnet/HalfDuplex.pm +++ b/lib/IO/Socket/Telnet/HalfDuplex.pm @@ -55,8 +55,8 @@ L. =head2 new(PARAMHASH) The constructor takes mostly the same arguments as L, but -also accepts the key C, which takes an integer from 0-255 to use -for the ping/pong mechanism. This defaults to 99 if not specified. +also accepts the key C, which takes an integer between 40 and 239 +to use for the ping/pong mechanism. This defaults to 99 if not specified. =cut @@ -64,6 +64,7 @@ sub new { my $class = shift; my %args = @_; my $ping = delete $args{PingOption} || 99; + die "Invalid option: $ping (must be 40-239)" if $ping < 40 || $ping >= 240; my $self = $class->SUPER::new(@_); ${*{$self}}{ping_option} = $ping; $self->IO::Socket::Telnet::telnet_simple_callback(\&_telnet_negotiation); -- cgit v1.2.3-54-g00ecf