Re: Deprecate 'nagle' (Was: Deprecate 'begin'?)

2009-07-13 Thread Alexander Burger
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


Deprecate 'nagle' (Was: Deprecate 'begin'?)

2009-07-12 Thread Alexander Burger
Hi all,

the same would apply to 'nagle' (network socket option), I suppose.

It should not be part of the core system, and could easily be written in
inline-C if really needed. I'd also remove it.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe