Dear monks,
problem is as follows: I use a combination of Socket and IO::Select, quite classic really. I open a number of socket connections using this little snippet:
sub makecon
{
my($self, $server, $port) = @_;
my($iaddr, $paddr, $filehandle);
my $proto = getprotobyname('tcp');
unless($iaddr = inet_aton($server)) { carp "No host found: $server";
+ return; }
$paddr = sockaddr_in($port, $iaddr);
unless(socket($filehandle, PF_INET, SOCK_STREAM, $proto)) { carp "so
+cket failure: $!"; return; }
unless(connect($filehandle, $paddr)) { carp "connect failure: $!"; r
+eturn; }
return $filehandle;
}
and then stuff the filehandle into IO::Select so I can perform the classic select loop to check which filehandles have data available. However, what I'm trying to do now is to implement a detection system for when a socket has died. Having read the documentation for IO::Select my first impression was that IO::Select->has_exception() would be the perfect tool to do so but for some reason it refuses to give me back anything, even though I am absolutely sure that the connection is dead on the other side. Any suggestions or ideas?