[fpc-pascal]Nonblocking socket - end of socket
    Georgi Georgiev 
    skelet_bg at yahoo.com
       
    Wed Sep 17 06:46:59 CEST 2003
    
    
  
 --- Sebastian_Günther <sguenther at gmx.de> wrote: >
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)
>
I think that if the socket (or file) is in nonblocking
mode, 
count may be -1, and  LinuxError=11 { Err_TryAgain }
means that connection is OK, but there is no incoming
data
(input is not finished).
 
> 
> - Sebastian
> 
> 
> _______________________________________________
> fpc-pascal maillist  - 
> fpc-pascal at lists.freepascal.org
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal 
=====
Skelet
====== http://skelet.hit.bg
________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://mail.messenger.yahoo.co.uk
    
    
More information about the fpc-pascal
mailing list