From ea9ba58da58fc03e4b1ae1d6e277dad8189fa920 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 19 Mar 2016 06:54:14 -0700 Subject: Size mode meaningful in datagram sockets. * socket.c (struct dgram_stream): new rx_max member. (make_dgram_sock_stream): New arguments: a struct stdio_mode, and pointer to prototype dgram socket. If a size is specified in the mode, then use that as rx_max. Otherwise if a prototype socket is specified, use its rx_max as the new socket's rx_max. Otherwise default on 65536. (dgram_get_byte_callback): Use d->rx_max as the capture size, rather than a hard-coded 65536. (sock_accept): Use d->rx_max as capture size for datagram. Parse the mode. Pass the parsed mode to make_dgram_sock_stream, as well as the accepting socket, so it can set up the rx_max for the new socket. (open_sockfd): Parse the mode and pass to make_dgram_sock_stream. * stream.c (parse_mode): Static function becomes extern. * stream.h (parse_mode): Declared. * txr.1: Documented. --- txr.1 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 6adb7dfa..ff3d6481 100644 --- a/txr.1 +++ b/txr.1 @@ -37527,6 +37527,32 @@ Datagram servers should issue a new call should be issued for each client datagram, treating it as a new stream. +Datagram sockets ignore almost all aspects of the +.meta mode-string +passed in +.code open-socket +and +.codn sock-accept . +The only attribute not ignored is the buffer size specified +with a decimal digit character; however, it cannot be the +only item in the mode string. The string must be syntactically +valid, as described under the +.code open-file +function. The buffer size attribute controls the size used by +the datagram socket for receiving a datagram: the capture size. +A datagram socket has obtains a default capture size if one isn't +specified by the +.metn mode-string . +The default capture size is 65536 bytes for a datagram socket created by +.codn open-socket . +If a size is not passed to +.code sock-accept +via its +.meta mode-string +argument when it is invoked on a datagram socket, +that socket's size is used as the capture size of the +newly created datagram socket which is returned. + .coNP Structure @ sockaddr .synb .mets (defstruct sockaddr nil) -- cgit v1.2.3