net helper functions

Not used anywhere (yet)
Merge pull request #696 from seandst/socket-helper

net helper functions