<div>Oh dear, some things are surprisingly enough impossible to do in standard Unix API:s: the *only* way to know if there's EOF is to actually do a read of > 0 bytes.</div><div><br></div><div>(> 0 because 0 is the return value that signals EOF, eh.)</div>


<div><br></div><div><font face="courier new, monospace">select()</font> on a closed socket instantaneously returns read-ability so this must be the basis for <span style="font-family:'courier new',monospace">port-wait-for-input</span>'s behavior, which is really fine of course.</div>


<div><br></div><div>That Unix API was clearly not made with even quite basic application-level abstraction of socket access in mind.</div><div><br></div><div>Very well, I suppose you always learn something new every day.</div>


<div><br></div><div>Thanks,</div><div>Mikael<br><div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Dear Marc,</div><div><br></div>

<div>
How do I know if a device port reached EOF?</div><div><br></div><div>Is there a flag internally in Gambit somewhere I suppose there is a flag internally somewhere in Gambit that keeps track of this. <font face="courier new, monospace">|wait-for-input|</font> just returns immediately. Of course I could do something like <font face="courier new, monospace">(read-subu8vector v 0 1 port 0)</font> though in this particular application I'd much prefer to only do the socket reading and writing completely outside the scope of Gambit's IO system.</div>



<div><br></div><div>If it's not in Gambit then please just say so, there's always another implementation path, though I'd appreciate not to go into higher complexity than needed.</div><div><br></div><div>Thanks!</div>



<div><br></div><div><br></div><div><font face="courier new, monospace">(define (port-wait-for-input port)</font></div><div><font face="courier new, monospace">  (##wait-for-io!</font></div><div><font face="courier new, monospace">   (device-port-rdevice-condvar port)</font></div>



<div><font face="courier new, monospace">   (port-rtimeout port)))</font></div><div><br></div>
</blockquote></div><br></div></div>