Page 1 of 1

setsockopt / getsockopt

Posted: Mon Dec 17, 2007 5:00 pm
by frontera000
i am in need of setting some socket options. specifically, i am interested in setting send and receive socket level buffer sizes. these numbers can affect network throughput performance significantly. i am writing some high performance network apps and the lack of socket option API is getting in the way. i could import shared library but i think perhaps newLISP needs these things in the socket API. that allows more portable way of setting options (winsock and BSD style )

any thoughts?

Posted: Mon Dec 17, 2007 5:52 pm
by Lutz
you can easily import setsockopt() from libc, on OS X:

Code: Select all

> (import "libc.dylib" "setsockopt")
setsockopt <95446B74>
> 
all parameters except for optionPtr are streight forward integers. The option value is passed as a ptr. So you would do:

Code: Select all

(set 'optionPtr (pack "ld" SO_SNDBUF))
and then pass optionPtr as the parameter and option length would be 4.

Lutz