in reply to accept() dies?

Shouldn't you do something like:
$main_socket = IO::Socket->new( # params ); # something useful here $new_sock = $main_socket->accept(); # continue
?
IO::Socket advertises accept() as a method not as an exported function; as pointed in the POD, the arguments passed to accept() are wrong.

Hope this helps ;-)

Dodge This!

Replies are listed 'Best First'.
Re^2: accept() dies?
by polettix (Vicar) on Jun 16, 2005 at 08:28 UTC
    The OP is calling the accept built-in function, not the method in IO::Socket. And yes, this is questionable.

    Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

    Don't fool yourself.
Re^2: accept() dies?
by beemshake (Novice) on Jun 16, 2005 at 21:45 UTC
    Sorry, guess I wasn't clear. That is what I'm doing. My code calls IO::Socket::accept, but in debugging I tracked it into that function, to the call to perl's accept(). That's the code I showed, my hacked version of IO::Socket. IO::Socket::accept's call to perlfunc's accept blows up.
      Oh, sorry for the misunderstanding ...
      Are you passing a timeout to the IO::Socket constructor?
      Also, are you forking after the creation of $sock? if so, all the child processes call accept() upon $sock?
      A .t file that triggers the "bug" would be more than welcome.

      Dodge This!