I need one of my C# .NET applications to act as a bootp server. The protocol is pretty simple but I dont know an easy way to build/parse the binary data.
Any ideas:

(source: tcpipguide.com)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s a couple ways to do this. You might be able to play around with the marshaling attributes such as StructLayout to pack a structure into a byte array but this is probably tricky and not worth the effort.
You could use a specialized framework such as Protobuf to attribute a class in such a way that it will be serialized to match the structure you need.
But in my experience, the easiest, fastest, and most flexible method of creating a binary structure like this is to use a MemoryStream class to hold a buffer of byes, then use a BinaryWriter around it to actually write the binary data into the stream.
In any case, it helps to have a working server to reference. Use a tool like Wireshark or Microsoft Network Monitor to capture the wire traffic so you can compare your wire format to an example that is known to work.