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