Tested code for converting between network and host adress formats