I am trying to get my socket writes to be non-blocking. So far I have been unsuccessful. I am using an IO::Socket::UNIX type socket for interprocess communication. After opening it, I set the blocking flag to 0 but this does not seem to make my syswrite call non-blocking. Below are some snippets of my perl code and a print out from my logging. The logging clearly shows that the sywrite is blocking. Anyone have any idea how I can resolve this problem? Are UNIX sockets able to work in a non-blocking mode? Any help greatly appreciated, kwo
my $s = IO::Socket::UNIX->new( Type => SOCK_STREAM, Local => $sockname, Listen => 10, ReuseAddr => 1, ); if ( not $s ) { logerr("Can't create socket $sockname : $!"); exit $PACE::Constants::DAEMON_EXIT; } # Vantive ? : Set the Socket to non-blocking. $s->blocking(0); my $tmp_val = $s->blocking(); logdbg( 15, "Blocking flag = $tmp_val\n"); ... logdbg(14, "writeSocket : File # $fn has $size bytes to send.\n"); # if no data to write just return return if ($size == 0); $sent = syswrite $wh, $buf, $size; logdbg(14, "writeSocket : $size bytes attempted, $sent bytes writt +en.\n"); ... 06/01/31 15:49:56 Agent: writeSocket : File # 35 has 100098 bytes to s +end. 06/01/31 15:50:26 Agent: writeSocket : 100098 bytes attempted, 100098 +bytes written.

In reply to How do I get my IO::Socket::UNIX sockets to be non-blocking? by kwopublic

Title:
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, details, 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, summary, 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.