@@ -52,3 +52,36 @@ And since Cython+ GIL-free types are allocated to the heap and referenced by poi
...
@@ -52,3 +52,36 @@ And since Cython+ GIL-free types are allocated to the heap and referenced by poi
This is still an unfinished implementation, so I'll add to it as I need.
This is still an unfinished implementation, so I'll add to it as I need.
## Echo Server and Client
Using [Beej's Guide to Network Programming](https://beej.us/guide/bgnet/html//index.html) as a handy reference, I wrote adapters for needed parts of the POSIX socket API. As much as practical, these adapters mirror [Python's socket API](https://docs.python.org/3/library/socket.html).
These adapters include the functions:
-`getaddrinfo`
-`socket`
-`connect`
-`bind`
-`listen`
-`accept`
-`recv`
-`send`
-`shutdown`
-`close`
The new GIL-free strings proved very useful for this :)
Also, since currently Cython+ doesn't have GIL-free exceptions (also in our next steps), I take the GIL and raise Python exceptions instead when there is an error.
It's not complete, but it's enough to write a minimal echo server and client demo: