http://qs321.pair.com?node_id=733191


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

The socket is just a plain Perl socket, so all Perl socket rules apply. Whatever normally works for your operating system should be fine.

POE::Wheel::ReadWrite will send an ErrorEvent as soon as the socket reports a problem.

The "Invalid argument" error means that one of your parameters to setsockopt() is incorrect, but it doesn't say which. You should inspect the parameters to verify they're correct for your operating system.

  • 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 06:41 UTC
    Here is my OS:
    [larry@localhost ]$ uname -a Linux localhost 2.6.21 #1 SMP Mon Nov 3 16:32:36 CST 2008 x86_64 x86_6 +4 x86_64 GNU/Linux
    and I add the setsockopt line just like the following reference:
    http://perldesignpatterns.com/?SocketProgramming

    I can't figure out which param is the evil :(.

      You didn't use the same pack() pattern that perldesignpatterns.com does. That page shows pack('LL', 15, 0) while your original example uses 'll'. Uppercase 'LL' and lowercase 'll' are a bit different.

      Perhaps more importantly, that page explains why it uses 'LL' and how to determine what should work for you. The instructions look good, so I recommend following them (if you haven't already).

      You may wish to carefully compare the example with your code. You may be overlooking some other difference.