Are there any modules for GPC which allow me to implement IPC with sockets?
I know that I can write such a library in C and then create it as pascal library, but why to invent the wheel?
Personally, I just external the socket stuff directly and write to that, eg:
type sockaddr = packed record sin_len: UInt8; sin_family: UInt8; sa_data: packed array[0..13] of UInt8; end; sockaddr_in = packed record sin_len: UInt8; sin_family: UInt8; sin_port: UInt16; sin_addr: ipAddr; sin_zero: packed array[0..7] of UInt8; end; sockaddr_in_ptr = ^sockaddr_in;
function socket( domain: int; typ: int; protocol: int ): int; external name 'socket'; function bind( socket: int; name: sockaddr_in_ptr; namelen: int ): int; external name 'bind'; function listen( socket: int; backlog: int ): int; external name 'listen'; function accept( socket: int; name: sockaddr_in_ptr; var namelen: int ): int; external name 'accept'; function connect( socket: int; name: sockaddr_in_ptr; namelen: int ): int; external name 'connect';
and so forth.
It's a triffle tedious to convert the C stuff over, but since I do it ad hoc as needed, it's not to bad at any one time. It's a bit error prone and obviously not going to handle changing the interfaces or porting to another unix system, but my code is all heaviy Mac specific anyway so no big deal there.
Enjoy, Peter.