in reply to IO::Socket::INET $Socket->recv won't time out

The recv() call is normally used only on a connected socket

from recv manual page in unix system( basically recv system call)
but perldoc -f recv says, (perl's recv function)
This call is actually implemented in terms of recvfrom(2) system call. See "UDP: Message Passing" in perlipc for examples.
so you can see man perlipc
I think in this case that server has nothing to give you immediately, you can use MSG_DONTWAIT flag in recv, (on unix systems see man recv for more information on flags to recv). this will make recv to return immediately if no data is available on socket.
Alternatively you can use select function to wait for data to be ready on the socket , if it is ready go and read it using recv. See perldoc -f select or man perlipc


Vivek
-- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet.
  • Comment on Re: IO::Socket::INET $Socket->recv won't time out

Replies are listed 'Best First'.
Re^2: IO::Socket::INET $Socket->recv won't time out
by zwon (Abbot) on Mar 13, 2009 at 19:28 UTC
    The recv() call is normally used only on a connected socket

    That's actually a connected socket, new() connects socket if PeerAddr and PeerPort specified.