client server socket programming example 1 in python

Published: 07 April 2020
on channel: Roshni Thanka
88
1

client server socket programming example 1(part 1) in python

Server

import socket

ss=socket.socket()
print("Socket created")
ss.bind(('localhost',5005))
ss.listen(4)

cs,addr=ss.accept()
print("The client address is :",addr)

while True:
username=cs.recv(1024).decode()
password=cs.recv(1024).decode()

if(str(username)=='apple' and str(password)=='mango'):
cs.send(bytes("Login successfull",'ascii'))
else:
cs.send(bytes("Try again", 'ascii'))
cs.close()

Client:

import socket

cs=socket.socket()
cs.connect(('localhost',5005))

while True:
username=input("Enter the username")
cs.send(bytes(username,'ascii'))
password=input("Enter the password")
cs.send(bytes(password, 'ascii'))
print(cs.recv(1024).decode())

cs.close()


On this page of the site you can watch the video online client server socket programming example 1 in python with a duration of hours minute second in good quality, which was uploaded by the user Roshni Thanka 07 April 2020, share the link with friends and acquaintances, this video has already been watched 88 times on youtube and it was liked by 1 viewers. Enjoy your viewing!