client side code
import socket
import sys
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost",9999))
path=raw_input("Please enter the complete PATH of your file : ")
f=open (path, "rb")
l = f.read(2048)
while (l):
s.sendall(l)
l = f.read(2048)
s.close()
server side code
import socket
import sys
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("localhost",9999))
s.listen(10)
while True:
s, address = s.accept()
print address
i=1
f = open( str(i),'wb') #open in binary
i=i+1
while (True):
l = s.recv(2048)
f.write(l)
l = s.recv(2048)
print 'File recieve succesfully'
f.close()
s.close()