Hello, I am starting a simple UDP listener and trying to adjust the receive buffer size, however even on reading the information, it seems to throw an error.
Code Snippet
const dgram = require('dgram');
const {getsockopt, setsockopt} = require('sockopt')
const SO_RCVBUF = 0x1002
const SOL_SOCKET = 0xffff
function startUDPServer (port = 9060, address = defaultBindIP) {
const socket = dgram.createSocket('udp4')
socket.on('error', (err) => log('UDP Error', err.message))
socket.on('listening', () => {
log('UDP Started', socket.address().address, socket.address().port)
console.log('SO_RCVBUF is', getsockopt(socket, SOL_SOCKET, SO_RCVBUF));
setsockopt(socket, SOL_SOCKET, SO_RCVBUF, 1024); // 1MB
console.log('SO_RCVBUF is now', getsockopt(socket, SOL_SOCKET, SO_RCVBUF));
})
socket.on('close', () => log('UDP Socket Closed', socket.address().address, socket.address().port))
socket.on('message', (msg, socket) => {
udpMsg++;
processMessage(msg, socket);
})
socket.bind(port, address)
}
This works fine without the getsockopt bits used.
Which causes the following error:
node_modules/sockopt/index.js:17
return _getsockopt(fd(socket), level, flagName)
^
TypeError: getsockopt failed: Operation not supported (95)
at getsockopt (/var/apps/hep-connexcs/node_modules/sockopt/index.js:17:9)
at Socket.<anonymous> (/var/apps/hep-connexcs/modules/ingress.js:32:32)
at Socket.emit (events.js:400:28)
at startListening (dgram.js:172:10)
at dgram.js:364:7
at processTicksAndRejections (internal/process/task_queues.js:83:21)
Hello, I am starting a simple UDP listener and trying to adjust the receive buffer size, however even on reading the information, it seems to throw an error.
Code Snippet
This works fine without the
getsockoptbits used.Which causes the following error: