Changes between Version 2 and Version 3 of IntroductionToMultiplayerGameProgramming

Show
Ignore:
Author:
bhook (IP: 64.207.62.170)
Timestamp:
05/26/06 22:38:53 (13 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IntroductionToMultiplayerGameProgramming

    v2 v3  
    491491Because endianess plays such a key role in network communications (and UDP is big-endian internally), there are several socket library functions designed to convert from "network" endianess (big-endian) to host endianess. These functions are: 
    492492 
    493 {{{ntohl()}}} - network-to-host byte ordering, long (32-bits) 
    494 {{{ntohs()}}} - network-to-host byte ordering, short (16-bits) 
    495 {{{htonl()}}} - host-to-network byte ordering, long (32-bits) 
    496 {{{htons()}}} - host-to-network byte ordering, short (16-bits) 
     493  * {{{ntohl()}}} - network-to-host byte ordering, long (32-bits) 
     494  * {{{ntohs()}}} - network-to-host byte ordering, short (16-bits) 
     495  * {{{htonl()}}} - host-to-network byte ordering, long (32-bits) 
     496  * {{{htons()}}} - host-to-network byte ordering, short (16-bits) 
    497497 
    498498For a more robust solution, I would recommend that you handle endianess issues at a higher level, using your own macros/functions. Alternatively, you can look at the [http://www.poshlib.org POSH] headers.