13.07.2015 Views

Beej's Guide to Network Programming Using Internet Sockets

Beej's Guide to Network Programming Using Internet Sockets

Beej's Guide to Network Programming Using Internet Sockets

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Beej’s <strong>Guide</strong> <strong>to</strong> <strong>Network</strong> <strong>Programming</strong> <strong>Using</strong> <strong>Internet</strong> <strong>Sockets</strong> 53Return ValueEach function returns the converted value.Exampleuint32_t some_long = 10;uint16_t some_short = 20;uint32_t network_byte_order;// convert and sendnetwork_byte_order = h<strong>to</strong>nl(some_long);send(s, &network_byte_order, sizeof(uint32_t), 0);some_short == n<strong>to</strong>hs(h<strong>to</strong>ns(some_short)); // this expression is true

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!