Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changes between Version 3 and Version 4 of SocketPrimer

Show
Ignore:
Author:
jpelcis (IP: 68.112.60.116)
Timestamp:
09/02/06 18:40:14 (8 years ago)
Comment:

Fixed the italics.

Legend:

Unmodified
Added
Removed
Modified
  • SocketPrimer

    v3 v4  
    66== General Network Stuff == 
    77=== Endianness === 
    8         For various reasons beyond the scope of this document, different types of computers store and send data differently. The gist of it it, do you store/send the big end first, or the little end first. Why all this is important is that network address are <i>always</i> in "Network byte order". Never mind what that is exactly, but for portability sake, never directly set a network port number or IP address. Use either the host &lt-&gt network conversion function or some library facility. 
     8        For various reasons beyond the scope of this document, different types of computers store and send data differently. The gist of it it, do you store/send the big end first, or the little end first. Why all this is important is that network address are ''always'' in "Network byte order". Never mind what that is exactly, but for portability sake, never directly set a network port number or IP address. Use either the host &lt-&gt network conversion function or some library facility. 
    99 
    1010        Another gotcha on this is that sending raw data across a network connection only works if the two computers use the same byte order. Don't count on that. Pick a byte order (if one hasn't already been standardized) and convert the data to it from whatever is native to the host system. Similarly on receiving data convert it from the chosen byte order to the host order. This isn't as bad as it may seem, most platforms do this fairly well in hardware and many programming environments have high level constructs to do the conversion automatically. (Tango has high level [http://tango.dsource.org/docs/current/tango.io.protocol.EndianReader.html abstractions] to take care of this.)