digitalmars.D.learn - Network programming
- Andre Kostur (12/12) May 24 2014 I'm finally making my first concerted foray into D programming. Being a...
- Andre Kostur (3/15) May 24 2014 Of course in fine tradition... minutes after posting one finds an
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?
May 24 2014
On 2014-05-24, 11:18 AM, Andre Kostur wrote: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?Of course in fine tradition... minutes after posting one finds an answer. I'm looking too low... std.bitmanip has what I'm looking for.
May 24 2014