Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Error - A non-blocking socket operation could not be completed immediately.

by BrowserUk (Pope)
on Mar 06, 2013 at 14:33 UTC ( #1022014=note: print w/ replies, xml ) Need Help??


in reply to Error - A non-blocking socket operation could not be completed immediately.

A non-blocking socket operation could not be completed immediately.

The extended error suggests that an attempt to read from the socket has simply failed because there is not yet any data available. A common condition with non-blocking sockets.

That is -- and this is wild speculation -- the module has probably issued/sent the command to the server; and then entered a read loop in order to retrieve the output; but as the socket is non-blocking, instead of waiting for the output to be available, it is assuming the command has failed rather than retrying.

Just a guess, but one that fits the scenario.

Given that your code can do nothing else until it gets the output; why are you setting it non-blocking? Is the module designed to be used that way?

(Note: I've never used the module and know nothing about its internals or use. But maybe this speculation will help you?)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: Error - A non-blocking socket operation could not be completed immediately.
Re^2: Error - A non-blocking socket operation could not be completed immediately.
by perl514 (Pilgrim) on Mar 06, 2013 at 17:08 UTC

    Hi BrowserUK,

    Thank you for taking time to reply. I was browsing through PerlMonks a few weeks ago while trying to write a similar script that used the Net::SSH2 module and a thread mentioned to set $chan->blocking(0) to get things working. Tried that and it worked. Now, even when I remove it, I still get the same error.

     

    Perlpetually Indebted To PerlMonks

    use Learning::Perl; use Beginning::Perl::Ovid; print "Awesome Books";
    http://dwimperl.com/windows.html is a boon for Windows.

      I don't have anything useful to add I'm afraid. I posted mainly to point out that the extended error is to be expected (and accommodated) with non-blocking handles; and that the logic of your test code shouldn't require non-blocking socket.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1022014]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2014-09-23 08:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (211 votes), past polls