[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Patch to add disabling Nagle algorithm
From: |
Wallace Owen |
Subject: |
Patch to add disabling Nagle algorithm |
Date: |
Mon, 09 Jul 2001 14:43:34 -0700 |
Here's a patch to socket.h and socket.cpp to add the ability to set
TCP_NODELAY on and off. I've never used Windows, so I can't be trusted
to write the Windows version of this. Hopefully it's trivial.
// Wally, avid user, puzzled docs reader
diff -r CommonC++-1.5.0/posix/socket.cpp
CommonC++-1.5.0-withnagleopt/posix/socket.cpp
51a52
> #include <netinet/tcp.h>
337a339,349
> return SOCKET_SUCCESS;
> }
>
> sockerror_t Socket::setNoDelay(bool enable)
> {
> int opt = (enable ? 1 : 0);
>
> if(setsockopt(so, IPPROTO_TCP, TCP_NODELAY,
> (char *)&opt, (socklen_t)sizeof(opt)))
> return Error(SOCKET_NODELAY_ERROR);
>
diff -r CommonC++-1.5.0/posix/socket.h
CommonC++-1.5.0-withnagleopt/posix/socket.h
112a113
> SOCKET_NODELAY_ERROR,
565a567,575
>
>
> /**
> * Enable/disable delaying packets (Nagle algorithm)
> *
> * @return 0 on success.
> * @param disable Nagle algorithm when set to true.
> */
> sockerror_t setNoDelay(bool enable);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Patch to add disabling Nagle algorithm,
Wallace Owen <=