setsockopt / getsockopt

Started by frontera000, December 17, 2007, 09:00:56 AM

Previous topic - Next topic

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?

Lutz

#1
you can easily import setsockopt() from libc, on OS X:


> (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:



(set 'optionPtr (pack "ld" SO_SNDBUF))


and then pass optionPtr as the parameter and option length would be 4.



Lutz