Skip to content

Program for creating Echo Client and Echo Server using TCP Sockets Links. (19CS406 - Computer Networks)

Notifications You must be signed in to change notification settings

Harsayazheni/Computer-Networks-8

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

EX-8 APPLICATION USING TCP SOCKETS - CREATING ECHO CLIENT-SERVER

DATE :26-04-2023

AIM :

To write a python program for creating Echo Client and Echo Server using TCP Sockets Links.

ALGORITHM :

  1. Import the necessary modules in python
  2. Create a socket connection to using the socket module.
  3. Send message to the client and receive the message from the client using the Socket module in server.
  4. Send and receive the message using the send function in socket.

PROGRAM :

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())

SERVER :

import socket

s = socket.socket()
s.bind(('localhost', 8000))
s.listen(5)

c, addr = s.accept()

while True:
    client_message = c.recv(1024).decode()
    c.send(client_message.encode())

OUTPUT :

CLIENT :

SERVER :

RESULT :

Thus, the python program for creating Echo Client and Echo Server using TCP Sockets Links was successfully created and executed.

About

Program for creating Echo Client and Echo Server using TCP Sockets Links. (19CS406 - Computer Networks)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published