File writing locally and TCP connection

not yet tested everytingghgh