Using setsockopt:

Here are instructions on how to use setsockopt to set TCP buffer sizes within your application:
 

setsockopt() Sample Usage:
    int skt, int sndsize;
    err = setsockopt(skt, SOL_SOCKET, SO_SNDBUF, (char *)&sndsize,
                                 (int)sizeof(sndsize));

or:
    int skt, int sndsize;
    err = setsockopt(skt, SOL_SOCKET, SO_RCVBUF, (char *)&sndsize,
                                 (int)sizeof(sndsize));

getsockopt() Sample Usage: (use this to see what socket is currently set to) 

     int    sockbufsize = 0;
  int    size = sizeof(int);

    err = getsockopt(skt, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &size);

Note: its a good idea to always call getsockopt after setting the buffer size, to make sure that the OS supports buffers of that size. The best place to check it is after the server listen or client connect. Some OS's seem to modify the TCP window size to their max or default at that time.