0% found this document useful (0 votes)
2 views

python exp6

The document contains Python code for a simple client-server application using sockets. The server listens for connections on localhost at port 5234 and accepts client connections, while the client connects to the server and sends a name. The document also includes references to the college and batch information.

Uploaded by

Abhijit Logavi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

python exp6

The document contains Python code for a simple client-server application using sockets. The server listens for connections on localhost at port 5234 and accepts client connections, while the client connects to the server and sends a name. The document also includes references to the college and batch information.

Uploaded by

Abhijit Logavi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

A.

C PATIL COLLEGE OF ENGINEERING PYTHON LAB

Code:
server.py-
import socket
s= socket.socket()
print(“socket Created”)
s.bind((‘localhost’,5234))
s.listen(3)
print(‘Waiting for Connections’)
while True:
c,addr=s.accept()
name = c.recv(1024).decode()
print(“Cennected with”,addr,name)
#c.send(bytes(‘Welcome to SE Class’),’utf-8’)
c.close()

client.py-
import socket
c = socket.socket()
c.connect((‘localhost’,5234))
name = input(“Enter your name”)
c.send(bytes(name,’utf-8’))
print(c.recv(1024).decode())

Batch: S2 Sem IV Page No:


A.C PATIL COLLEGE OF ENGINEERING PYTHON LAB

Output:

server.py (final output)

You might also like