-
Notifications
You must be signed in to change notification settings - Fork 25
Confusing TCP connection states #16
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
Comments
Related to #27 |
The
I'm in the process of updating TCP and there's some complexity here. Take for example a hardware network stack like the W5500. When you call From a simplicity perspective, I think it makes more sense to have a"constructor" to allocate the socket resource and then explicitly |
Maybe the state of the socket could be encoded in it's type (possibly as a generic type parameter). For example it does not make much sense to |
The difficulty is that |
The current life of a TCP socket looks superfluously complex: It can be created ("open", although it's not really clear what is opened there), but only when it is connected it becomes useful. It can be closed again, but it is not clear from the documentation whether anything can be done with a closed socket other than being dropped. (Can a closed socket be connected again? From the types it could, but that wouldn't work on POSIX sockets AFAIK).
Wouldn't it be more straightforward to have a single awaitable (OK, nb::Result) client connecting function?
When TCP server functionality is added, that'd probably be centered around different types anyway (possibly a TcpServerSocket that has an accept method).
The text was updated successfully, but these errors were encountered: