Replies: 0 comments 8 replies
|
What you're describing is the expected behavior, there's no bug. I think you may be confusing From the documentation on
|
|
I understand what you saying about. But.
|
|
On my opinion, problem can be, if socket has no 'data' listener, it ignores all packets including FIN packet. Try https://github.com/didkovsky/onend/tree/main/tcp example, with the commented string |
This is expected. The |
|
But why it's emitted if the "data" listener is attached? If we have .on('data') listener, and we got the 'end' signal, socket will be closed. |
|
Streams start out in paused mode. Attaching a |
|
This is a good point. Thank you. If we call const { createServer } = require('net')
createServer(socket => {
// Returns false
console.log(socket.isPaused())
}).listen(444)Also, this is not an answer why we do not receiving the From nodejs doc:
Also from doc:
If we check |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Version
v19.2.0
Platform
OSX 12.15.1
Subsystem
No response
What steps will reproduce the bug?
I found few cases when a Socket from node/net isn't closes when it should. Examples:
TCP issue
If a listener .on('data') on a server socket not defined, the 'end' signal from the clients side will be ignored.
Server source
Client source
HTTP issue 1
This issue is a consequence of the TCP issue above. If we have not listener .on('data') on a req object, the 'end' signal from the clients side will be ignored.
Server source
Client source
HTTP issue 2
Server cannot close connection through res.end().
Server source
Clien source
Repo with examples: https://github.com/didkovsky/onend
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
If I call socket.end() I expect to get 'end' event. And stop receiving data on .on('data') listener.
What do you see instead?
If we have not .on('data') listener, socket ignore 'end' signal.
Additional information
No response
All reactions