I'm trying to port the python telnetlib module into nim as an exercise to learn more about nim. So far the porting has been surprisingly simple, since nim and python's syntax are pretty similar and the module itself does not use many other python module.
However, the python telnetlib module does use Python's select module, which is used to wait for a socket to have data available.
Looking at the nim standard library I see that there is a selectors module. However its documentation is very terse. It does not even have a top level description. Looking at the procedures that it provides it seems to be kind of similar to Python's select module, but its API is quite different. For starters python's select module offers quite a few platform specific functions and a separate "poll" and "select" functions, which the telnetlib module uses. I don't see anything similar in nim's selectors module.
Anyway, I wonder if there is some example of using the selectors module that I can use to get a better idea of how to use it?
As an alternative, I wonder if I could in fact avoid using it altogether and use use nim's high level net interface directly...
https://github.com/def-/nim-unsorted/blob/master/selectors_hello.nim
Also, it seems that when using the high level network modules (net and asyncnet) there is no need to use selectors.
Can you compile the example code in asyncnet?
await is moved to threadpool?
Can you compile the example code in asyncnet?
Works for me with the current devel compiler. No threadpool required.
Thanks. My mistake.
I am building msgpack-rpc on top of asyncnet. The implementation forgot async pragma then await wasn't found.