To write a python program for creating File Transfer using TCP Sockets Links
- Import the necessary python modules.
- Create a socket connection using socket module.
- Send the message to write into the file to the client file.
- Open the file and then send it to the client in byte format.
- In the client side receive the file from server and then write the content into it.
DEVELOPED BY:DINESH S
REGISTER NUMBER:212222230033
import socket
s=socket.socket()
s.connect(('localhost',90))
while True:
msg=input("Client > ")
s.send(msg.encode())
print("Server > ",s.recv(1024).decode())
import socket
s=socket.socket()
s.bind(('localhost',90))
s.listen(5)
c,addr=s.accept()
while True:
ClientMessage=c.recv(1024).decode()
c.send(ClientMessage.encode())
Thus, the python program for creating File Transfer using TCP Sockets Links was successfully created and executed.