1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-09-22 04:15:55 -04:00

Set TCP_NODELAY on sockets for streams and fileserving.

Adapted from a patch sent by Richard Galli

svn path=/trunk/net/; revision=4260
This commit is contained in:
Michael Smith 2003-01-18 07:08:00 +00:00
parent 38a1834bd6
commit 6bc46604b9
2 changed files with 10 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <netdb.h>
@ -200,6 +201,14 @@ int sock_set_nolinger(sock_t sock)
sizeof(struct linger));
}
int sock_set_nodelay(sock_t sock)
{
int nodelay = 1;
return setsockopt(sock, SOL_TCP, TCP_NODELAY, (void *)nodelay,
sizeof(int));
}
int sock_set_keepalive(sock_t sock)
{
int keepalive = 1;

View File

@ -66,6 +66,7 @@ int sock_valid_socket(sock_t sock);
int sock_set_blocking(sock_t sock, const int block);
int sock_set_nolinger(sock_t sock);
int sock_set_keepalive(sock_t sock);
int sock_set_nodelay(sock_t sock);
int sock_close(sock_t sock);
/* Connection related socket functions */