1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 03:30:27 +02:00

socket: TCP_CORK, TCP_NODELAY

* libguile/socket.c (scm_init_socket): Define TCP_NODELAY and TCP_CORK
  if they are available.
* doc/ref/posix.texi (Network Sockets and Communication): Add
  documentation.
* NEWS: Add entry.
This commit is contained in:
Andy Wingo 2012-03-26 00:25:03 +02:00
parent 9454068a54
commit d7f39a36b1
3 changed files with 21 additions and 0 deletions

3
NEWS
View file

@ -54,6 +54,9 @@ avoid the crashes that led to the introduction of locking, but without
locks. For that reason we have removed port locks, and removed the
"_unlocked" port API variants that were introduced in 2.1.0.
* New interfaces
** `TCP_NODELAY' and `TCP_CORK' socket options, if provided by the system
* New deprecations
** `_IONBF', `_IOLBF', and `_IOFBF'

View file

@ -3178,6 +3178,15 @@ supporting that.
@end defvar
@end deffn
For @code{IPPROTO_TCP} level the following @var{optname}s are defined
(when provided by the system). For their meaning see @command{man 7
tcp}.
@defvar TCP_NODELAY
@defvarx TCP_CORK
The @var{value} taken or returned is an integer.
@end defvar
@deffn {Scheme Procedure} shutdown sock how
@deffnx {C Function} scm_shutdown (sock, how)
Sockets can be closed simply by using @code{close-port}. The

View file

@ -40,6 +40,7 @@
#include <sys/un.h>
#endif
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <arpa/inet.h>
@ -1713,6 +1714,14 @@ scm_init_socket ()
scm_c_define ("MSG_DONTROUTE", scm_from_int (MSG_DONTROUTE));
#endif
/* TCP options. */
#ifdef TCP_NODELAY
scm_c_define ("TCP_NODELAY", scm_from_int (TCP_NODELAY));
#endif
#ifdef TCP_CORK
scm_c_define ("TCP_CORK", scm_from_int (TCP_CORK));
#endif
#ifdef IP_ADD_MEMBERSHIP
scm_c_define ("IP_ADD_MEMBERSHIP", scm_from_int (IP_ADD_MEMBERSHIP));
scm_c_define ("IP_DROP_MEMBERSHIP", scm_from_int (IP_DROP_MEMBERSHIP));