You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running this code (taken from blockwise_put.js) to send a chunk of data:
const coap = require('../')
const bufferSize = 250000
const testBuffer = Buffer.alloc(bufferSize)
const containedData = 'This is a test buffer with a lot of nothing and a bit of something'
testBuffer.fill('X', 'utf-8')
testBuffer.write(containedData, 'utf-8')
testBuffer.write(containedData, testBuffer.length - containedData.length, containedData.length, 'utf-8')
const request = coap.request({
hostname: 'fdd2:3ab9:44ef:78c5:3b48:3e87:df48:678e',
port: 5683,
pathname: '/test',
method: 'PUT'
})
request.setOption('Block1', Buffer.from([6]))
request.on('response', (res) => {
console.log('Client Received Response: ' + res.payload.toString('utf-8'))
console.log('Client Received Response: ' + res.code)
process.exit(0)
})
console.log('Sending large data from client...')
request.end(testBuffer)
console.log('Sent to server')
RetrySendError: No reply in 247 seconds.
at Timeout._onTimeout (/home/admin/coap/node_modules/coap/dist/lib/retry_send.js:56:25)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)
Emitted 'error' event on OutMessage instance at:
RetrySend.emit (node:events:518:28)
at Timeout._onTimeout (/home/admin/coap/node_modules/coap/dist/lib/retry_send.js:58:22)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7) {
retransmitTimeout: 247
inet6 fdd2:3ab9:44ef:78c5:0:ff:fe00:9c00 prefixlen 64 scopeid 0x0<global> │}
While this is the stdout of the client:
Sending large data from client...
Sent to server
Client Received Response: Congratulations!
Client Received Response: 2.04
So, the reponse from the server seems to be parsed.
Do you have an idea why the packet is being retransmitted?
The text was updated successfully, but these errors were encountered:
request.on('response', (res) => {
console.log('Client Received Response: ' + res.payload.toString('utf-8'))
console.log('Client Received Response: ' + res.code)
process.exit(0)
})
gets called when the confirmable server response arrives.
Since the client then exits, the coap stack does not get the chance to confirm the server response.
Changing the callback to this fixes the issue:
request.on('response', (res) => {
console.log('Client Received Response: ' + res.payload.toString('utf-8'))
console.log('Client Received Response: ' + res.code)
setTimeout(process.exit, 10)
})
Hey, thanks for your work!
I am running this code (taken from blockwise_put.js) to send a chunk of data:
And this code (same source) to receive:
Now, I am observing this behavior in wireshark:
And this error on the receiving side:
While this is the stdout of the client:
So, the reponse from the server seems to be parsed.
Do you have an idea why the packet is being retransmitted?
The text was updated successfully, but these errors were encountered: