[fpc-pascal]Nonblocking socket - end of socket
Sebastian Günther
sguenther at gmx.de
Tue Sep 16 17:08:52 CEST 2003
Georgi Georgiev schrieb:
> There is another way, if you use file descriptor calls
> for non-blocked socket:
>
> ...
> count:=fdRead(socket,data,size);
> socket_eof:=(count=0) and (LinuxError=0);
> ...
eeehm normally fdread returns -1 for closed sockets, so you can obmit
the LinuxError part and just write:
socket_eof := count <= 0;
This will work both for files (where zero means EOF) and sockets (where
-1 means error, such as broken pipe)
- Sebastian
More information about the fpc-pascal
mailing list