[fpc-devel] Non-blocking sockets on Mac OS X

Aleš Katona almindor at gmail.com
Thu Sep 7 14:56:21 CEST 2006


On Št, 2006-09-07 at 12:52 +0000, Robert Reimiller wrote:
> Having some trouble porting some code from Delphi to FreePascal running
> on MAC OS X (power pc). On Delphi to set a socket non-blocking I would
> normally do:
> 
>        flag := 1 ;
>        ioctl (cpath, FIONBIO, flag) ;
> 
> However the compiler doesn't seem to recognize FIONBIO or ioctl. Another  
> standard
> Unix method would be :
> 
>        flag := 1 ;
>        fcntl (cpath, FNDELAY, flag) ;
> 
> Again, those aren't recognized. I've tried adding baseunix and unix to the  
> uses
> clause (along with sockets) with no effect. Other common items not  
> recognized are
> EWOULDBLOCK and ECONNRESET socket error codes (among others I would think).
> 
> Anyone know where I can find this functionality?
> 
> Thanks,
> 
> Bob


You could use lNet which implement non-blocking sockets on all fpc
platforms (well.. most) from http://members.chello.sk/ales

As for this concrete problem you need to use "fpfcntl".

Ales




More information about the fpc-devel mailing list