<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: write on socket sleeping in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349512#M684028</link>
    <description>If the client is blocking, yes, absolutely.  Non-blocking is only a _local_ attribute of a socket.  It means nothing for any remote socket.</description>
    <pubDate>Wed, 04 Feb 2009 18:01:18 GMT</pubDate>
    <dc:creator>rick jones</dc:creator>
    <dc:date>2009-02-04T18:01:18Z</dc:date>
    <item>
      <title>write on socket sleeping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349505#M684021</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I have two processes talking to each other through a socket mechanism.&lt;BR /&gt;They are written in C language and run on a HP-UX 11.31 Itanium platform.&lt;BR /&gt;&lt;BR /&gt;One process hungs in writing on the socket.&lt;BR /&gt;&lt;BR /&gt;By using "tusc" tool I see that "write" call is in "sleeping" status.&lt;BR /&gt;&lt;BR /&gt;Why and when a "write" remains in "sleeping" status?&lt;BR /&gt;&lt;BR /&gt;How can I manage such a condition?&lt;BR /&gt;&lt;BR /&gt;Many thanks&lt;BR /&gt;&lt;BR /&gt;Giuseppe&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Feb 2009 13:30:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349505#M684021</guid>
      <dc:creator>Fedele Giuseppe</dc:creator>
      <dc:date>2009-02-02T13:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: write on socket sleeping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349506#M684022</link>
      <description>If the type of socket/protocol you're using requires the recipient to acknowledge the data before the write operation is considered complete, this happens when the acknowledge does not arrive.&lt;BR /&gt;&lt;BR /&gt;You could use the setsockopt() system call to set time-out values (SO_SNDTIMEO and SO_RCVTIMEO) for your socket: the standard default value is 0, which means the system will wait forever. This must be done before the socket is actually written to.&lt;BR /&gt;&lt;BR /&gt;Then you should check the return value of your write() operation to see whether all the data was sent successfully or not. If the amount of data sent is less than the size of what you meant to send or -1, you'll know there was a problem and the timeout may have been triggered. Examine the errno variable to identify the problem type, then have your program do something appropriate to the situation.&lt;BR /&gt;&lt;BR /&gt;You may wish to Google for examples of the use of setsockopt() or refer to books on Unix network programming for details.&lt;BR /&gt;&lt;BR /&gt;For a nice "big picture" overview I'd recommend Chapter 8 of "Advanced UNIX Programming" by Marc J. Rochkind (Addison-Wesley, ISBN 978-0-13-141154-8).&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Mon, 02 Feb 2009 23:56:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349506#M684022</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2009-02-02T23:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: write on socket sleeping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349507#M684023</link>
      <description>I am not sure that the timeouts are implemented under HP-UX - best check that before relying on it.&lt;BR /&gt;&lt;BR /&gt;As for why a write could block - a socket by default is in a "blocking" mode.  If the socket buffer (SO_SNDBUF) is full, the write() call against the socket will block until there is enough space to get the all the bytes of the write() into the socket buffer.  For something like a TCP connection between two processes, it means that the remote TCP has to have sent an ACKnowledgement for the data.&lt;BR /&gt;&lt;BR /&gt;You can either always have SO_SNDBUF &amp;gt; the maximum number of bytes you will have outstanding on the socket/connection before a "natural" stopping point (eg maximum request size times maximum number of requests outstanding) or you can make the socket non-blocking and sit in a select/poll/devpoll call waiting for the socket to become writable.&lt;BR /&gt;&lt;BR /&gt;Of course, if the other side of the connection "never" pulls data out of the connection, you could end-up waiting a very long time for the socket to become writable.  So, you will have a timeout on that select/poll/devpoll and have to decide what to do when that timeout is reached.</description>
      <pubDate>Tue, 03 Feb 2009 00:33:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349507#M684023</guid>
      <dc:creator>rick jones</dc:creator>
      <dc:date>2009-02-03T00:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: write on socket sleeping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349508#M684024</link>
      <description>Hello Matti,&lt;BR /&gt;&lt;BR /&gt;the socket is set for nonblocking I/O through the system call:&lt;BR /&gt;&lt;BR /&gt;fcntl(socket, F_SETFL, O_NDELAY)&lt;BR /&gt;&lt;BR /&gt;moreover the returned code of "write" is checked to verify that is greater than 0.&lt;BR /&gt;&lt;BR /&gt;So, for what I know, the "write" should not block if the recipient does not acknowledge.&lt;BR /&gt;&lt;BR /&gt;Isn'i it?&lt;BR /&gt;&lt;BR /&gt;Do you think that setting timeouts I will avoid to fall in such a condition?&lt;BR /&gt;&lt;BR /&gt;Giuseppe</description>
      <pubDate>Tue, 03 Feb 2009 09:07:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349508#M684024</guid>
      <dc:creator>Fedele Giuseppe</dc:creator>
      <dc:date>2009-02-03T09:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: write on socket sleeping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349509#M684025</link>
      <description>Hello Rick,&lt;BR /&gt;&lt;BR /&gt;if I have well understood, your analisys refer to blocking sockets.&lt;BR /&gt;(My mistake: I forgot to specify that my socket was nonblocking)&lt;BR /&gt;&lt;BR /&gt;So, my question is: which could be the reason why a nonblocking sockets hungs?&lt;BR /&gt;&lt;BR /&gt;Many thanks&lt;BR /&gt;&lt;BR /&gt;Giuseppe&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Feb 2009 09:17:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349509#M684025</guid>
      <dc:creator>Fedele Giuseppe</dc:creator>
      <dc:date>2009-02-03T09:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: write on socket sleeping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349510#M684026</link>
      <description>I would triple check that you are:&lt;BR /&gt;&lt;BR /&gt;1) checking the return value of the fcntl call&lt;BR /&gt;&lt;BR /&gt;2) calling it against the correct file descriptor&lt;BR /&gt;&lt;BR /&gt;and&lt;BR /&gt;&lt;BR /&gt;3) the fcntl call is returning success.&lt;BR /&gt;&lt;BR /&gt;Some of that would be through code inspection, some of that could be accomplished with the tusc system call trace tool with which you are already familiar.&lt;BR /&gt;&lt;BR /&gt;If all those checks "pass" then you should bundle-up a test case and exercise the old support contract to get the response center to file a defect.</description>
      <pubDate>Tue, 03 Feb 2009 18:22:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349510#M684026</guid>
      <dc:creator>rick jones</dc:creator>
      <dc:date>2009-02-03T18:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: write on socket sleeping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349511#M684027</link>
      <description>After having analyzed more in dept the code, I have seen that the socket is set in nonblocking mode only on server side.&lt;BR /&gt;&lt;BR /&gt;Could this be the issue?&lt;BR /&gt;&lt;BR /&gt;Giuseppe&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Feb 2009 10:05:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349511#M684027</guid>
      <dc:creator>Fedele Giuseppe</dc:creator>
      <dc:date>2009-02-04T10:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: write on socket sleeping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349512#M684028</link>
      <description>If the client is blocking, yes, absolutely.  Non-blocking is only a _local_ attribute of a socket.  It means nothing for any remote socket.</description>
      <pubDate>Wed, 04 Feb 2009 18:01:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349512#M684028</guid>
      <dc:creator>rick jones</dc:creator>
      <dc:date>2009-02-04T18:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: write on socket sleeping</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349513#M684029</link>
      <description>Ok, I will set also client socket in nonblocking mode.&lt;BR /&gt;&lt;BR /&gt;Many thanks&lt;BR /&gt;&lt;BR /&gt;Giuseppe</description>
      <pubDate>Sat, 07 Feb 2009 09:08:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/write-on-socket-sleeping/m-p/4349513#M684029</guid>
      <dc:creator>Fedele Giuseppe</dc:creator>
      <dc:date>2009-02-07T09:08:17Z</dc:date>
    </item>
  </channel>
</rss>

