Start of networking code

Broken, incomplete, but its a start.