added server code. fixed network code to connect