Commit 21f67d41 authored by Xavier Thompson's avatar Xavier Thompson

README: Add echo server and client section

parent b1066299
......@@ -58,3 +58,37 @@ Actually at first I wanted to avoid `std::string` because they incur unneeded bu
That initial implementation remains available in branch `string`.
## 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`
- `setsockopt` (only for options with integer values, which is all I needed)
- `connect`
- `bind`
- `listen`
- `accept`
- `recv`
- `send`
- `shutdown`
- `close`
The new GIL-free strings proved very useful for this :)
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 simple echo server and client demo:
```
make echoserver
```
and
```
make client
```
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment