-
-
Save jots/11469118 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# length of data in 32-bit unsigned, network (big-endian) byte order | |
# plus the data (and increase length by 4 to account for length field | |
def packed(xml) | |
[xml.size + 4].pack("N") + xml | |
end | |
puts packed("a test packet") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment