EX-8 APPLICATION USING TCP SOCKETS - CREATING ECHO CLIENT-SERVER
To write a python program for creating Echo Client and Echo Server using TCP Sockets Links.
2.Get the frame size from the user
3.To create the frame based on the user request.
4.To send frames to server from the client side.
5.If your frames reach the server, it will send ACK signal to client otherwise it will send NACKsignal to client.
import socket
s = socket.socket()
s.connect(('localhost', 8000))
while True:
msg = input("Client > ")
s.send(msg.encode())
print("Server > ", s.recv(1024).decode())
import socket
s = socket.socket()
s.bind(('localhost', 8000))
s.listen(5)
c, addr = s.accept()
while True:
ClientMessage = c.recv(1024).decode()
c.send(ClientMessage.encode())
![5serout](https://private-user-images.githubusercontent.com/121704588/241559282-dfc905ad-9f6f-42c0-91d4-886c42d2fe96.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM2NDU0MTcsIm5iZiI6MTcyMzY0NTExNywicGF0aCI6Ii8xMjE3MDQ1ODgvMjQxNTU5MjgyLWRmYzkwNWFkLTlmNmYtNDJjMC05MWQ0LTg4NmM0MmQyZmU5Ni5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxNFQxNDE4MzdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hZDcxNTFlZTgzYjdkM2Y0MzQwMDJlODEyOTM5YTk2YzNmYTAxNmY5MGFjNTJjNzVmMTM4ZGJiMTJhYWY3NmViJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.x8S_p4w0FnlafocCzkfQa_nOzENGyD8eL0XpKXU6yso)
![5cliout](https://private-user-images.githubusercontent.com/121704588/241559267-01ac3b7b-0d3a-4134-8988-fe131864026c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM2NDU0MTcsIm5iZiI6MTcyMzY0NTExNywicGF0aCI6Ii8xMjE3MDQ1ODgvMjQxNTU5MjY3LTAxYWMzYjdiLTBkM2EtNDEzNC04OTg4LWZlMTMxODY0MDI2Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxNFQxNDE4MzdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xNWU2NzQ4NDVmZDBkOWYzZTNjZjZjODkzM2Y5ZWNlYjdmYzdmZTkzYzVlMDcxM2Y0MWNjOWE5YTZiZDc3ZjZkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9._apiT5vnqSAYVUzI9jnP44SOAQsvNgt2K6EPtuCf-1g)
Thus, the python program for creating Echo Client and Echo Server using TCP Sockets Links was successfully created and executed.