in reply to How to set a timeout for the socket filehandle generated by POE::Wheel::SocketFactory ?

Can't locate object method "sockopt" via package "FileHandle"

Perhaps you are looking for setsockopt?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."
  • Comment on Re: How to set a timeout for the socket filehandle generated by POE::Wheel::SocketFactory ?

Replies are listed 'Best First'.
Re^2: How to set a timeout for the socket filehandle generated by POE::Wheel::SocketFactory ?
by sunshine_august (Scribe) on Dec 30, 2008 at 05:35 UTC
    setsockopt doesn't work neither.
    ... use Socket; use POSIX; use IO::Handle; ... sub onWheelSFSuccess { my ( $heap, $clientSocket, $peerHostN, $peerPort ) = @_[ HEAP, ARG0, ARG1, ARG2 ]; my $peerHost = inet_ntoa($peerHostN); my $timeout = pack( 'll', 5, 0 ); #$clientSocket->sockopt(SO_RCVTIMEO, $timeout ); #$clientSocket->sockopt(SO_SNDTIMEO, $timeout ); setsockopt ( $clientSocket, SOL_SOCKET, SO_RCVTIMEO, $timeout ) or warn "Can't do setdosockotp: $!\n"; setsockopt ( $clientSocket, SOL_SOCKET, SO_SNDTIMEO, $timeout ) or warn "Can't do setdosockotp: $!\n"; my $ioWheel = POE::Wheel::ReadWrite->new( Handle => $clientSocket, InputEvent => 'onWheelRWInput', ErrorEvent => 'onWheelRWError', Filter => POE::Filter::Stream->new(), ); ......
    It complaint :
    Can't do setdosockotp: Invalid argument Can't do setdosockotp: Invalid argument