Echo server and client using python socket
To develop a simple webserver to serve html programming pages.
Design of echo server and client using python socket
Implementation using Python code
Testing the server and client
server code:
import socket
s=socket.socket()
host=socket.gethostname()
port=1234
s.bind((host, port))
s.listen(5)
while True:
conn, addr = s.accept()
print("Got connection from :", addr)
conn.send(b'Thank you for connecting')
conn.close()
client code:
import socket
s=socket.socket()
host=socket.gethostname()
port=1234
s.connect((host,port))
print(s.recv(1024))
s.close()
The program is executed successfully

