4 ms·
I like writing toy servers too, but I don't get a lot of opportunities, so my latest project is a programming challenge that presents a new protocol spec every
by jstanley 4y ago
I like writing toy servers too, but I don't get a lot of opportunities, so my latest project is a programming challenge that presents a new protocol spec every 2 weeks for people to implement, and automatically tests the implementations[0].
OP says:
> Goal: write a basic server that can handle the WS handshake and parse an incoming WS frame to see the message sent from the client
> Non-goals: writing a robust or real HTTP server, writing a fully compliant WS server, or handling all edge cases
This is a great way to get started with something that you don't yet understand. I sometimes think of it as implementing "just enough to trick people into thinking that it works".
FWIW, I think the implementation in this post has a bug whereby a client that sends half an HTTP request will block the entire server from accepting further connections, because handle_request() makes blocking calls to recv() until it has a full request, and the program can't accept new connections until handle_request() returns. That's the spirit!
[0] https://protohackers.com/ https://protohackers.com/
- macintux 4y agoThis looks very cool, thanks for creating/sharing it. Might have to dust off my Erlang for this.
- paulgb 4y agoSort of like Project Euler but for network programming? Very cool!
- rizach8 4y agoThis is great. Gives me a reason to try a new backend language as well.
- mcintyre1994 4y agoNice, thanks for sharing! This looks like a neat way to experiment with backend languages :)