On Linux, SOMAXCONN (the maximum size of the listen queue for a socket) is not a static constant, but is a configurable kernel parameter. Here is a simple Python command to return the value for your currently-running
kernel:
print(int(open("/proc/sys/net/core/somaxconn", "rt").read().strip()))
On Mon, 12 Feb 2024 01:54:52 +0000, Lawrence D'Oliveiro wrote:
On Linux, SOMAXCONN (the maximum size of the listen queue for a socket) is >> not a static constant, but is a configurable kernel parameter. Here is a
simple Python command to return the value for your currently-running
kernel:
print(int(open("/proc/sys/net/core/somaxconn", "rt").read().strip()))
Here's the (ba)sh equivalent command:
cat /proc/sys/net/core/somaxconn
On Linux, SOMAXCONN (the maximum size of the listen queue for a socket) is not a static constant, but is a configurable kernel parameter. Here is a simple Python command to return the value for your currently-running
kernel:
print(int(open("/proc/sys/net/core/somaxconn", "rt").read().strip()))
On Mon, 12 Feb 2024 01:54:52 +0000, Lawrence D'Oliveiro wrote:
On Linux, SOMAXCONN (the maximum size of the listen queue for a socket)
is not a static constant, but is a configurable kernel parameter. Here
is a simple Python command to return the value for your
currently-running kernel:
print(int(open("/proc/sys/net/core/somaxconn",
"rt").read().strip()))
Here's the (ba)sh equivalent command:
cat /proc/sys/net/core/somaxconn
On Mon, 12 Feb 2024 13:51:06 -0000 (UTC), Lew Pitcher wrote:
On Mon, 12 Feb 2024 01:54:52 +0000, Lawrence D'Oliveiro wrote:
On Linux, SOMAXCONN (the maximum size of the listen queue for a socket)
is not a static constant, but is a configurable kernel parameter. Here
is a simple Python command to return the value for your
currently-running kernel:
print(int(open("/proc/sys/net/core/somaxconn",
"rt").read().strip()))
Here's the (ba)sh equivalent command:
cat /proc/sys/net/core/somaxconn
Code normally needs it as an integer.
On Mon, 12 Feb 2024 13:51:06 -0000 (UTC), Lew Pitcher wrote:
On Mon, 12 Feb 2024 01:54:52 +0000, Lawrence D'Oliveiro wrote:
On Linux, SOMAXCONN (the maximum size of the listen queue for a socket)
is not a static constant, but is a configurable kernel parameter. Here
is a simple Python command to return the value for your
currently-running kernel:
print(int(open("/proc/sys/net/core/somaxconn",
"rt").read().strip()))
Here's the (ba)sh equivalent command:
cat /proc/sys/net/core/somaxconn
Code normally needs it as an integer.
On Mon, 12 Feb 2024 20:46:04 +0000, Lawrence D'Oliveiro wrote:
On Mon, 12 Feb 2024 13:51:06 -0000 (UTC), Lew Pitcher wrote:
On Mon, 12 Feb 2024 01:54:52 +0000, Lawrence D'Oliveiro wrote:
On Linux, SOMAXCONN (the maximum size of the listen queue for a socket) >>>> is not a static constant, but is a configurable kernel parameter. Here >>>> is a simple Python command to return the value for your
currently-running kernel:
print(int(open("/proc/sys/net/core/somaxconn",
"rt").read().strip()))
Here's the (ba)sh equivalent command:
cat /proc/sys/net/core/somaxconn
Code normally needs it as an integer.
If you say so...
$(($(cat /proc/sys/net/core/somaxconn) + 1))
I added 1 to somaxconn. It's math, so I must have an integer.
On Mon, 12 Feb 2024 20:58:53 -0000 (UTC), Lew Pitcher wrote:
On Mon, 12 Feb 2024 20:46:04 +0000, Lawrence D'Oliveiro wrote:
Code normally needs it as an integer.
If you say so...
$(($(cat /proc/sys/net/core/somaxconn) + 1))
I added 1 to somaxconn. It's math, so I must have an integer.
Now use it as one.
I expect someone will post the COBOL version any minute now.
On Mon, 12 Feb 2024 20:46:04 +0000, Lawrence D'Oliveiro wrote:
Code normally needs it as an integer.
If you say so...
$(($(cat /proc/sys/net/core/somaxconn) + 1))
I added 1 to somaxconn. It's math, so I must have an integer.
Why do you think you need it in a program?
On Mon, 12 Feb 2024 13:51:06 -0000 (UTC), Lew Pitcher wrote:
On Mon, 12 Feb 2024 01:54:52 +0000, Lawrence D'Oliveiro wrote:
On Linux, SOMAXCONN (the maximum size of the listen queue for a socket)
is not a static constant, but is a configurable kernel parameter. Here
is a simple Python command to return the value for your
currently-running kernel:
print(int(open("/proc/sys/net/core/somaxconn",
"rt").read().strip()))
Here's the (ba)sh equivalent command:
cat /proc/sys/net/core/somaxconn
Code normally needs it as an integer.
(file-get "/proc/sys/net/core/somaxconn")128
(typeof (file-get "/proc/sys/net/core/somaxconn"))fixnum
On Mon, 12 Feb 2024 21:08:26 +0000, Lawrence D'Oliveiro wrote:
On Mon, 12 Feb 2024 20:58:53 -0000 (UTC), Lew Pitcher wrote:
On Mon, 12 Feb 2024 20:46:04 +0000, Lawrence D'Oliveiro wrote:
Code normally needs it as an integer.
If you say so...
$(($(cat /proc/sys/net/core/somaxconn) + 1))
I added 1 to somaxconn. It's math, so I must have an integer.
Now use it as one.
OK
echo SOMAXCONN plus 1 equals $(($(cat /proc/sys/net/core/somaxconn) +
1))
scott@slp53.sl.home (Scott Lurndal) writes: [...]
$ application -m $(cat /proc/sys/net/core/somaxconn)
$ application -m $(</proc/sys/net/core/somaxconn)
Why do you think you need it in a program?That is normally where SOMAXCONN is needed.
Why do you think you need it in a program?
If this is true, then there is no need to bother determining the explicit value of SOMAXCONN.
Some documentation suggests that calling listen(2) with a negative backlog
is equivalent to setting it to the maximum possible value. But this is not >documented in any place I’m aware of (e.g. ><manpages.debian.org/2/listen.en.html>).
That page does not mention EINVAL as a possible return status, so perhaps >such out-of-range values are acceptable and will be interpreted reasonably >after all?
If this is true, then there is no need to bother determining the explicit >value of SOMAXCONN.
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
Some documentation suggests that calling listen(2) with a negative backlog >>is equivalent to setting it to the maximum possible value. But this is not >>documented in any place I’m aware of (e.g. >><manpages.debian.org/2/listen.en.html>).
That page does not mention EINVAL as a possible return status, so perhaps >>such out-of-range values are acceptable and will be interpreted reasonably >>after all?
If this is true, then there is no need to bother determining the explicit >>value of SOMAXCONN.
POSIX says:
"The backlog argument provides a hint to the implementation
which the implementation shall use to limit the number of
outstanding connections in the socket's listen queue. Implementations
may impose a limit on backlog and silently reduce the specified value.
Normally, a larger backlog argument value shall result in a larger
or equal length of the listen queue. Implementations shall support
values of backlog up to SOMAXCONN, defined in <sys/socket.h>."
There's no need to determine the explicit value of SOMAXCONN (128 on
my fedora core installation sys/socket.h). There's no requirement
for the implementation to honor the backlog argument, it's just
a hint.
c) to be accurate, a linux program should retrieve the backlog maximum
by reading /proc/sys/net/core/somaxconn, rather than depending on the
value of SOMAXCONN from <sys/socket.h>
Yes, the backlog argument is a /hint/, but (apparently) a hint that the
linux kernel takes seriously.
cat /proc/sys/net/core/somaxconn
I expect someone will post the COBOL version any minute now.
On Mon, 12 Feb 2024 15:20:32 -0000 (UTC)
gazelle@shell.xmission.com (Kenny McCormack) wrote:
cat /proc/sys/net/core/somaxconn
I expect someone will post the COBOL version any minute now.
As Polonius said, "Brevity Is the soul of wit".
IDENTIFICATION DIVISION.
PROGRAM-ID. SHOW-SOMAXCONN.
AUTHOR. On behalf of Kenny McCormack.
DISPLAY "somaxconn is " DATUM. DIVIDE 1024 into DATUM.
DISPLAY "somaxconn is " DATUM " KB".
gcobol is the ISO COBOL front-end being developed for GCC.
On Mon, 08 Apr 2024 19:46:32 +0000, James K. Lowden wrote:
DISPLAY "somaxconn is " DATUM. DIVIDE 1024 into DATUM.
DISPLAY "somaxconn is " DATUM " KB".
Just a note that SOMAXCONN is a number of entries (the limit on the accept-pending queue), not a size in bytes.
gcobol is the ISO COBOL front-end being developed for GCC.
Is that different from gnucobol?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 299 |
Nodes: | 16 (3 / 13) |
Uptime: | 74:43:03 |
Calls: | 6,695 |
Calls today: | 5 |
Files: | 12,228 |
Messages: | 5,347,067 |
Posted today: | 1 |