Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net's onread doesn't work as intended #10719

Closed
soitchu opened this issue May 1, 2024 · 0 comments · Fixed by #10753
Closed

net's onread doesn't work as intended #10719

soitchu opened this issue May 1, 2024 · 0 comments · Fixed by #10753
Labels
bug Something isn't working

Comments

@soitchu
Copy link

soitchu commented May 1, 2024

What version of Bun is running?

1.1.6+e58d67b46

What platform is your computer?

Linux 6.8.1-arch1-1-surface x86_64 unknown

What steps can reproduce the bug?

Run the following code:

const net = require("net");
const opts = {
	host: "localhost",
	port: 143,
	onread: {
		buffer: Buffer.allocUnsafe(4096),
		callback: (size, buf) => {
			console.log(size);
		}
	}
};

net.connect(opts, () => console.log("Connected"));

What is the expected behavior?

onread's callback should be called when the socket receives data.

What do you see instead?

onread's callback is never called.

Additional information

The code works fine if node.js is used to run it. The documentation for this behavior can be found here.

@soitchu soitchu added the bug Something isn't working label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant