Code for TCP connections completed, not tested yet