Skip to content

Instantly share code, notes, and snippets.

@shichao-an
Created June 18, 2015 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shichao-an/27bb5bebddf78e36198e to your computer and use it in GitHub Desktop.
Save shichao-an/27bb5bebddf78e36198e to your computer and use it in GitHub Desktop.
#include <netinet/in.h>
uint16_t htons(uint16_t host16bitvalue);
uint32_t htonl(uint32_t host32bitvalue);
/* Both return: value in network byte order */
uint16_t ntohs(uint16_t net16bitvalue);
uint32_t ntohl(uint32_t net32bitvalue);
/* Both return: value in host byte order */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment