import socket host = "192.168.1.100" s = socket.socket() s.connect((host, 5500)) fd = open("input3.txt","r") FileList = fd.readlines() mensaje = "".join(FileList) s.send(mensaje) print "adios" s.close()