import socket
def Main():
host = '[Link]'
port = 5000
s = [Link]()
[Link]((host, port))
nameoffile='This is Tayyab nice to meet you'
filename = bytes(nameoffile,'utf-8')
if filename != 'q':
[Link](filename)
data = [Link](1024)
if data[:6] == 'EXISTS':
filesize = long(data[6:])
message = raw_input("File exists, " + str(filesize) +"Bytes, download? (Y/N)?
-> ")
if message == 'Y':
[Link]("OK")
f = open('new_'+filename, 'wb')
data = [Link](1024)
totalRecv = len(data)
[Link](data)
while totalRecv < filesize:
data = [Link](1024)
totalRecv += len(data)
[Link](data)
print ("{0:.2f}".format((totalRecv/float(filesize))*100)+ "% Done")
print ("Download Complete!")
[Link]()
else:
print ("File Does Not Exist!")
[Link]()
if __name__ == '__main__':
Main()