This blog is about how to implement TFTP protocol (RFC1350) with ragel. Ragel is a very powerful State Machine compiler, perfect for text parsing. One of the tasks where ragel can be used for is "Writing robust protocol implementations". More detailed information about ragel can be found here: http://www.colm.net/open-source/ragel . Indeed, there are projects which successfully use ragel to parse network protocol packets: Mongrel , the web-server developed by Zed Shaw. Mongrel and its derivatives (like Thin) are using ragel to parse HTTP protocol. OverSIP , SIP proxy developed by IƱaki Baz Castillo and using ragel to parse SIP protocol. Both HTTP and SIP are text based protocols. There are many articles and blogs that explain how to parse text with ragel. TFTP is a bit different and I thought it would be fun to try implement this protocol with ragel.