On Mon, Jul 13, 2009 at 08:54:54AM +0200, randall@gmail.com wrote:
With the new 'native' function are such capabilities are easily
available. I agree that deprecating things that are more consistently
done with the '(native ...' is better.
Yes. With the current testing version you can do
(def 'IPPROTO_TCP 6)
(def 'TCP_NODELAY 1)
(native NIL setsockopt 'I Sock IPPROTO_TCP TCP_NODELAY (4) 4)
(There is no function like 'connect' or 'listen' yet to populate 'Sock'
though, as the networking functions are still missing).
And for applications running on the 32-bit version it is sufficient to
include the following code fragment:
(load lib/gcc.l)
(gcc net NIL 'nagle)
#include netdb.h
#include sys/socket.h
#include netinet/tcp.h
// (nagle 'cnt 'flg) - cnt
any nagle(any ex) {
any x, y;
int sd, opt;
x = cdr(ex), y = EVAL(car(x));
sd = (int)xCnt(ex,y);
x = cdr(x), opt = isNil(EVAL(car(x)))? 1 : 0;
if (setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char*)opt, sizeof(int)) 0)
err(ex, NULL, IP setsockopt error: %s, strerror(errno));
return y;
}
/**/
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe