Move socket creation into net.h