network class added; main loop for tcp connections.