|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sflsock.h"
int
socket_nodelay (
sock_t handle)
Disables Nagle's algorithm for the specified socket; use this when you want to ensure that data is sent outwards as fast as possible, and when you are certain that Nagle's algorithm is causing a slowdown in performance. Recommended for HTTP, but not recommended for telnet. Returns 0 if okay, SOCKET_ERROR if there was a problem.
{
#if (defined (__WINDOWS__))
int
true_value = 1; /* Boolean value for setsockopt() */
return (setsockopt ((SOCKET) handle, IPPROTO_TCP, TCP_NODELAY,
(char *) &true_value, sizeof (true_value)));
#elif (defined (TCP_NODELAY) && defined (SOL_TCP))
int
true_value = 1; /* Boolean value for setsockopt() */
return (setsockopt ((SOCKET) handle, SOL_TCP, TCP_NODELAY,
(char *) &true_value, sizeof (true_value)));
#else
return (0); /* Not applicable to this system */
#endif
}
| | << | < | > | >> |
|