I can now read packets from the client.
Fragmentation as well as the close, ping and pong opcodes aren't implemented yet, though (everything is interpreted as binary data).
I successfully received and decoded messages with up to a MB in length. I implemented a message size limit of 2 GB though (the standard theoretically allows up to 16 Exabyte). To be honest I did this because supporting a larger limit would have required more complicated code. But putting a reasonable limit on the max packet size would be a smart thing to do anyway. The server has to allocate all that memory for a packet in advance, so it would be easy to exhaust the servers memory by sending a forget packet which pretends to be larger than it. When I think about it, a much MUCH lower limit than 2GB would be in order to avoid a memory-exhaustion DOS attacks. I couldn't imagine a use-case relevant for me which would require messages larger than a few KB.
No comments:
Post a Comment