The binary format method takes a template that describes how you want to pack the variables that follow the template string. These have meaning as follows:
- a* - take the first parameter (the literal "IP36") and convert all of the letters in 8-bit ASCII encoded values;
- S - take the second parameter (since it is the second item in the template) -- which is the operational code -- and convert it to a 16-bit unsigned integer using big-endian byte order (which is the same as network byte order);
- IIIIII - each of these is a 32-bit unsigned integer in big-endian byte order. In your specification, there is a byte stream 0x00000000 00000000 00000000 00000000 00000000 0000ffff (24 bytes total, or 6 x 4 bytes);
- I - again, a 32-bit unsigned integer in big-endian byte order, this is the leading 4 bytes of the address field (which, by your layout, is 8 bytes, so I assume the first 4 bytes are zeroes);
- c4 - the c is a one byte unsigned integer. c4 means "assume a list of four elements, and convert each element into an 8-bit integer". The split does exactly this: it splits the textual representation of the client IP (as dotted-quad) into a list of four elements, where each element is one byte of the IP address is descending (and big-endian) order;
- S - again, an unsigned 16-bit integer, it is passed the value of the client source port.
This might be of some value: