Professional Documents
Culture Documents
NAME-ROHIT KUMAR
REG.NO.- 728
ROLL NO.-CSE/21068
SUBJECT CODE- CSC611
EMAIL:- cse21068@iiitkalyani.ac.in
socket_family = socket.AF_INET
protocol = socket.SOCK_STREAM
IP_address = '127.0.0.1'
port_number = 12345
for i in range(data_length):
if data[i] == '1':
for j in range(key_length):
data[i + j] = str(int(data[i + j]) ^ int(key[j]))
try:
# Bind the IP address and Port number
server_socket.bind((IP_address, port_number))
# Listen and accept the client’s request for the connection
server_socket.listen(1)
print("Server is listening for incoming connections...")
except Exception as e:
print("Error:", e)
finally:
server_socket.close()
Client_code:-
import socket
socket_family = socket.AF_INET
protocol = socket.SOCK_STREAM
IP_address = '127.0.0.1'
port_number = 12345
for i in range(data_length):
if data[i] == '1':
for j in range(key_length):
data[i + j] = str(int(data[i + j]) ^ int(key[j]))
try:
# Connect to the server
client_socket.connect((IP_address, port_number))
print("Connected to server...")
except Exception as e:
print("Error:", e)
finally:
client_socket.close()
Output:-