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


in reply to help for accept sys call

(...) but many a times it returns some junk value. i do not know how is thsi happening.

And what is $GLOBAL_SERVER? What is that "junk value" that is being returned? I will assume that ->accept() is calling the perl's builtin accept().

If this supposition is correct, this snippet from perldoc -f accept might be enlightening:

accept NEWSOCKET,GENERICSOCKET
      Accepts an incoming socket connect, just as the accept(2) sys-
      tem call does. Returns the packed address if it succeeded,
      false otherwise. See the example in "Sockets: Client/Server
      Communication" in perlipc.

This "junk" could be the packed address of the client connecting to your socket. On the other hand, this might be IO::Socket->accept() instead of the builtin, so the earlier snippet would not apply directly...

Note that accept() can be interrupted by signals, so it may be returning undef. In any case, please provide a bit more of detail, so that we can properly help you.

Best regards

-lem, but some call me fokat