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

Event based api for receving socket data #300

Open
lal12 opened this issue Jul 6, 2022 · 1 comment
Open

Event based api for receving socket data #300

lal12 opened this issue Jul 6, 2022 · 1 comment

Comments

@lal12
Copy link
Contributor

lal12 commented Jul 6, 2022

Currently you have to call recv in a loop on an UDP socket.
So you have to specify a buffer of a fixed size, which might be too small or too large.

One solution would be to just return an allocated buffer if undefined is passed to recv.
However IMHO an (alternative) event/callback based API would be more suitable, since it is more in line how libuv works. Currently libuv is registering and unregistering a callback on each recv(…).

This also applies for TCP sockets, though I didn't look at that in detail.

@saghul
Copy link
Owner

saghul commented Aug 12, 2024

I may reevaluate this, in the context of #640

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants