I am trying to turn off Nagle's algorithm for a BSD socket using:
setsockopt(newSock, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, sizeof flag);
but the compiler claims TCP_NODELAY
hasn't been seen before:
error: `TCP_NODELAY' undeclared (first use this function)
This is the full list of includes for the file this is in:
#include <arpa/inet.h>
#include <fcntl.h>
#include <iostream>
#include <netdb.h>
#include <string>
#include <sys/socket.h>
#include <sys/types.h>
using namespace std;
I also have the -lnsl
and -lsocket
linker options, but it just won't compile. Am I missing something?
All of this is on a Solaris 8 machine.