This patch adds the bind function to go with the socket function. It also cleans up a lot of socket related data structures.