From be67f63f4e11e53690bf1431a236f86b484c9bf0 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Tue, 6 Oct 2015 11:33:50 +0800 Subject: Changed buffer-per-socket to buffer-per-operation. This is a difficult tradeoff to measure. I think large datagrams won't be used very frequently. So it is better to not lock a large buffer to each socket object and instead allocate and deallocate for each operation receiving a datagram larger than UDP_DATAGRAMSIZE. --- doc/reference.html | 2 ++ doc/socket.html | 25 ++++++++++++++++++++++++- doc/udp.html | 33 +++++++-------------------------- 3 files changed, 33 insertions(+), 27 deletions(-) (limited to 'doc') diff --git a/doc/reference.html b/doc/reference.html index 6067ba6..878e7d2 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -147,6 +147,7 @@ Support, Manual"> connect, connect4, connect6, +_DATAGRAMSIZE, _DEBUG, dns, gettime, @@ -158,6 +159,7 @@ Support, Manual"> skip, sleep, _SETSIZE, +_SOCKETINVALID, source, tcp, tcp4, diff --git a/doc/socket.html b/doc/socket.html index e6a9bf8..8a81414 100644 --- a/doc/socket.html +++ b/doc/socket.html @@ -90,7 +90,7 @@ of connect are defined as simple helper functions that restrict the -

+

socket._DEBUG

@@ -99,6 +99,19 @@ This constant is set to true if the library was compiled with debug support.

+ + +

+socket._DATAGRAMSIZE +

+ +

+Default datagram size used by calls to +receive and +receivefrom. +(Unless changed in compile time, the value is 8192.) +

+

@@ -393,6 +406,16 @@ The maximum number of sockets that the select function can handle.

+ + +

+socket._SOCKETINVALID +

+ +

+The OS value for an invalid socket. +

+

diff --git a/doc/udp.html b/doc/udp.html index 22d7c72..9437c51 100644 --- a/doc/udp.html +++ b/doc/udp.html @@ -42,7 +42,7 @@

-socket.udp([buffersize]) +socket.udp()

@@ -62,13 +62,6 @@ The setpeername is used to connect the object.

-

-The optional buffersize parameter -specifies the size of the largest datagram that will -ever be received by the UDP object. The default value is -8192. -

-

In case of success, a new unconnected UDP object returned. In case of error, nil is returned, followed by @@ -92,7 +85,7 @@ href=#setoption>setoption will fail.

-socket.udp4([buffersize]) +socket.udp4()

@@ -112,13 +105,6 @@ The setpeername is used to connect the object.

-

-The optional buffersize parameter -specifies the size of the largest datagram that will -ever be received by the UDP object. The default value is -8192. -

-

In case of success, a new unconnected UDP object returned. In case of error, nil is returned, followed by @@ -128,7 +114,7 @@ an error message.

-socket.udp6([buffersize]) +socket.udp6()

@@ -148,13 +134,6 @@ The setpeername is used to connect the object.

-

-The optional buffersize parameter -specifies the size of the largest datagram that will -ever be received by the UDP object. The default value is -8192. -

-

In case of success, a new unconnected UDP object returned. In case of error, nil is returned, followed by @@ -261,8 +240,10 @@ the excess bytes are discarded. If there are less then size bytes available in the current datagram, the available bytes are returned. If size is omitted, the -buffersize argument at creation time is used -(which defaults to 8192 bytes). +compile-time constant socket._DATAGRAMSIZE is used +(it defaults to 8192 bytes). Larger sizes will cause a +temporary buffer to be allocated for the operation.

-- cgit v1.2.3-55-g6feb