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

Non blocking receiving for async codes #20

Open
Slexyy opened this issue Jan 11, 2022 · 4 comments
Open

Non blocking receiving for async codes #20

Slexyy opened this issue Jan 11, 2022 · 4 comments

Comments

@Slexyy
Copy link

Slexyy commented Jan 11, 2022

It would be cool if the library supported non blocking receiving for async codes that it wouldn't block the event loop when receiving, like have an option to not block when initializing the library :-)

Thanks!

@rhelmot
Copy link
Owner

rhelmot commented Jan 11, 2022

You can run nc.settimeout(0) to disable blocking. Is this sufficient?

@Slexyy
Copy link
Author

Slexyy commented Jan 13, 2022

I'm working with UDP, still seems to block , hmm, my code is like this:

nc = nclib.Netcat(listen=9999, udp=True).settimeout(0)

and it won't let me continue with rest of the async tasks

@Slexyy
Copy link
Author

Slexyy commented Jan 13, 2022

Seems to be the same with TCP

@rhelmot
Copy link
Owner

rhelmot commented Jan 27, 2022

Oh, I didn't realize you were talking about initializing a listening service. I don't know if it's possible to not block for that... as far as I know, UDP needs to block on startup in order to determine what the address we should send to should be, and TCP needs to block on startup for the accept() call. Do you have a code example somewhere else that does what you want, perhaps in a different language? If it's possible, I can implement it, but rn I'm not convinced the interfaces let you do what you want.

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