[gambit-list] Something like ##device-port-eof? available?
Marc Feeley
feeley at iro.umontreal.ca
Tue Dec 18 17:08:10 EST 2012
To know if you have reached EOF you need to attempt a read. If you read with read-char/peek-char you will get #!eof. If you use read-subu8vector the result will be 0 on reaching EOF.
Marc
On 2012-11-19, at 1:21 PM, Mikael <mikael.rcv at gmail.com> wrote:
> Dear Marc,
>
> How do I know if a device port reached EOF?
>
> Is there a flag internally in Gambit somewhere I suppose there is a flag internally somewhere in Gambit that keeps track of this. |wait-for-input| just returns immediately. Of course I could do something like (read-subu8vector v 0 1 port 0) 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.
>
> 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.
>
> Thanks!
>
>
> (define (port-wait-for-input port)
> (##wait-for-io!
> (device-port-rdevice-condvar port)
> (port-rtimeout port)))
>
More information about the Gambit-list
mailing list