<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Luciano Rocha wrote:
<blockquote cite="mid:20071012101636.GA13778@bit.office.eurotux.com"
 type="cite">......<br>
  <pre wrap="">
Is there a reason for using SOCK_DGRAM instead of the usual SOCK_STREAM?
The latter will make the recv return 0, indicating the other end closed
the connection, as it did happen, as one peers exits before the other
select(2)s:

$ ./socketpair 
server - Socket is ready to write
server - Socket is not ready to read
exited: 14520
master - Socket is ready to write
master - Socket is ready to read
master - recv - Resource temporarily unavailable(11)

This could be a bug, or standard behaviour for disconnected datagram
sockets (I don't know enough of the standards).

  </pre>
</blockquote>
I attach a slightly improved version. This sleeps for an hour on both
sides. I have tried removing the MSG_DONTWAIT but still get the same
response.<br>
<br>
The SOCK_DGRAM is because I have small packets flowing that I do not
want fragmented but do not mind if they get lost, .... but then inside
a machine that does not matter. However with SOCK_STREAM I get zero
length messages but still ready to read continuously!!! See attached!<br>
<br>
<div class="moz-signature">-- <br>
<title>Signature</title>
<div class="Section1">
<table class="MsoNormalTable" style="width: 100%;" border="0"
 cellpadding="0" width="100%">
  <tbody>
    <tr style="">
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Howard Wilkinson</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Phone:</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">+44(20)76907075</p>
      </td>
    </tr>
    <tr style="">
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Coherent Technology Limited</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Fax:</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal"> </p>
      </td>
    </tr>
    <tr style="">
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">23 Northampton Square,</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Mobile:</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">+44(7980)639379</p>
      </td>
    </tr>
    <tr style="">
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">United Kingdom, EC1V 0HL</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal">Email:</p>
      </td>
      <td style="padding: 1.5pt;" valign="top">
      <p class="MsoNormal"><a name="howardcohtech.com"></a><a class="moz-txt-link-abbreviated" href="mailto:howard@cohtech.com">howard@cohtech.com</a></p>
      </td>
    </tr>
  </tbody>
</table>
<p class="MsoNormal"> </p>
</div>
</div>
</body>
</html>