in reply to problem with a blocking recv function over socket

try http://search.cpan.org/~gbarr/IO-1.24/lib/IO/Socket/INET.pm with http://search.cpan.org/~gbarr/IO-1.24/lib/IO/Select.pm

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: problem with a blocking recv function over socket

Replies are listed 'Best First'.
Re^2: problem with a blocking recv function over socket
by nav1729 (Initiate) on May 12, 2009 at 09:33 UTC

    i have already tried the second function in the following manner

    # print "\nCalling recv()..."; my $select = IO::Select->new(); $select->add(LINK_HNDL); if($select->can_read(0)) { recv(LINK_HNDL, $temp, $size - length($data), $flags); #print "**$temp**\n"; } else { #print "No data on socket.\n"; }

    instead of normal recieve call, but result is the application/server on board is getting slower, even during a healthy run. timeout is getting detected.

    so what i want is, some way of setting recv so that it won't block when server is dead(not sure of this term,I mean switching off server(board on which it is running)abruptly).
      have you tried , MSG_DONTWAIT , do not block
      http://fuse4bsd.creo.hu/localcgi/man-cgi.cgi?recv+2

      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.

        I have tried that already, in this fashion

        recv(LINK_HNDL, $temp, $size - length($data),MSG_DONTWAIT);

        can you tell me, if the usage is incorrect?
        I am getting following error message
        "Your vendor has not defined Socket macro MSG_DONTWAIT, used at tb_data_lnk.pm line 234."
        I am using perl version v5.8.8 built for MSWin32-x86-multi-thread, this is active perl.

        I have some more observation, like before perl control reaches recv function call, if i switch of the server(board), recv function was not behaving in a blocking manner. but during the perl is waiting on recv function, if i power off server board, it is not coming out of the recv function call