Linux c socket TCP_NODELAY fast send

If you want send packet immediately. Try this

         int flag = 1;
int result = setsockopt(sock, /* socket affected */
IPPROTO_TCP, /* set option at TCP level */
TCP_NODELAY, /* name of option */
(char *) &flag, /* the cast is historical
cruft */
sizeof(int)); /* length of option value */
if (result < 0)
... handle the error ...


leo friendly note: TCP_NODELAY is in
 

你可能感兴趣的:(Linux c socket TCP_NODELAY fast send)