diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 79ef959ae65..93ac5a6aa7d 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -3090,6 +3090,13 @@ Network Options may be a period of time after the last use of that port (by any process on the host) where it is not possible to make a new server on that port. + +@item :nodelay @var{nodelay-flag} +If @var{nodelay-flag} is non-@code{nil}, the @code{TCP_NODELAY} option +is enabled on the socket. This disables the Nagle algorithm, meaning +that network segments are sent as soon as possible, even when they +contain little data. This reduces network latency on the network +connection, but can lead to many small packets being sent. @end table @defun set-network-process-option process option value &optional no-error diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index f058fc48cc7..07eb4690fce 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -6049,8 +6049,8 @@ bytecomp--check-keyword-args :buffer :host :service :type :family :local :remote :coding :nowait :noquery :stop :filter :filter-multibyte :sentinel :log :plist :tls-parameters :server :broadcast :dontroute - :keepalive :linger :oobinline :priority :reuseaddr :bindtodevice - :use-external-socket) + :keepalive :linger :oobinline :priority :reuseaddr :nodelay + :bindtodevice :use-external-socket) '(:name :service)))) (provide 'byte-compile) diff --git a/src/process.c b/src/process.c index b71ba3daf2d..0b994d6c5b7 100644 --- a/src/process.c +++ b/src/process.c @@ -38,6 +38,7 @@ Copyright (C) 1985-1988, 1993-1996, 1998-1999, 2001-2024 Free Software #include #include #include +#include #include #else @@ -2860,6 +2861,9 @@ DEFUN ("set-process-datagram-address", Fset_process_datagram_address, Sset_proce #endif #ifdef SO_REUSEADDR { ":reuseaddr", SOL_SOCKET, SO_REUSEADDR, SOPT_BOOL, OPIX_REUSEADDR }, +#endif +#ifdef TCP_NODELAY + { ":nodelay", IPPROTO_TCP, TCP_NODELAY, SOPT_BOOL, OPIX_MISC }, #endif { 0, 0, 0, SOPT_UNKNOWN, OPIX_NONE } };