perlquestion
Sol-Invictus
On a tcp server socket, I want to use a timeout to log out clients that have become inactive after 5 mins, so after reading this:
<P>
(from IO::Socket pod)<br>
<code>
timeout([VAL])
Set or get the timeout value associated with this socket. If called
without any arguments then the current setting is returned. If
called with an argument the current setting is changed and the pre-
vious value returned.
</code>
<P>
I wrote a socket which opens like this:<P>
<code>
use IO::Socket;
use IO::Select;
$max_msglen = 1024;
$max_clients = 10;
$port = 9999;
$timeout = 300;
$serverSocket = IO::Socket::INET->new( Proto=>"tcp",
LocalPort=>$port,
Listen=>$max_clients,
Timeout =>$timeout,
Reuse=>1
);
$sel = IO::Select->new($serverSocket);
</code>
<P>
but it doesn't time out the clients. Looking for answers I went here:<P>
(from IO::Select pod)<br>
<code>
select ( READ, WRITE, ERROR [, TIMEOUT ] )
"select" is a static method, that is you call it with the package
name like "new". "READ", "WRITE" and "ERROR" are either "undef" or
"IO::Select" objects. "TIMEOUT" is optional and has the same effect
as for the core select call.
</code>
<p>
So now I'm really confused - <P>
Firstly: What is the socket timeout I've set up actually doing?<P>
Secondly: is the "core select" mentioned the same as the one I've tried to call on the socket at startup time?<P>
Thirdly: Should I be checking for return values to catch the timeout event, if so where?<P>