Network programming

Andre Kostur via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat May 24 11:18:48 PDT 2014


I'm finally making my first concerted foray into D programming.  Being a 
networking guy (and a good history in C and C++) I'm starting with some 
network code (and trying to use vibe.d as well).  However, I'm running 
into some holes that I'm not sure if I'm overlooking something or just 
that nobody has run into these themselves yet.  As a quick overview, I'm 
looking to talk to the netlink and tun interfaces on linux, as well as 
raw IP packets (below UDP and TCP).

First up is the D equivalent to htons/ntohs.  I've found 
core.bitop.bswap, but that only works on 32-bit values, and not 16.  And 
come to think of it, it would be blindly swapping the bytes.  What about 
platforms (hello, sparc) where host byte order is the same as network 
byte order?


More information about the Digitalmars-d-learn mailing list