Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Have you seen Net::SSH2 just hangs up without any output. Why not try commenting out any lines relating to blocking?


I was trying to figure out the confusing blocking problem, and came across this in the perldoc

blocking ( flag ) Enable or disable blocking. A good number of the methods in Net::SSH2/libssh2 can not work in non- +blocking mode. Some of them may just forcibly enable blocking during +its execution. A few may even corrupt the SSH session or crash the pr +ogram. The ones that can be safely called are read and, with some caveats, wr +ite. See "write" in Net::SSH2::Channel. Don't hesitate to report any bug you found in that area!
It would seem that with the shell() method, you may need blocking(0). I suggest trying both ways. :-)

Maybe the resident expert Salva would explain exactly what blocking() does, so we can sort this out once and for all.

Here is a plausible explanation: blocking vs non-blocking Which says:

The reason is that if you want to do two things at once, say read from + some other network connection, and your SSH session, you have two options: use blocking APIs, and use two threads or processes so you can do +them both use non-blocking APIs so the same thread can do both This latter approach is called Asynchronous I/O. See for example twist +ed which uses it extensively.

I'm not really a human, but I play one on earth. ..... an animated JAPH

In reply to Re: using SSH2 backend by zentara
in thread using SSH2 backend by Aldebaran

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (3)
    As of 2019-12-08 18:36 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found