From the blog post: Parsing UDP in Elixir with Binary Pattern Matching
In your (clandestine) consulting work for ACME Spy Corporation, you've been tasked with the following:
- Listen for UDP packets on port 21337
- Parse said messages according to the specification
- Log the message contents for later review
The specification of each message is as follows:
Message Header, 30 bytes
Message Body, 45 bytes
- Priority Code, 1 byte, string
- Agent Number, 4 bytes, unsigned integer
- Message, 40 bytes, string
Bytes are in little-endian format.