Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write code in PYTHON.TWO FILES SERVER.PY and CLIENT.PY Keeping the specifications in mind below Modify the client.py and server.py provided and Use a 2 dimensional

Write code in PYTHON.TWO FILES SERVER.PY and CLIENT.PY
Keeping the specifications in mind below
Modify the client.py and server.py provided and
Use a 2 dimensional parity checker. image text in transcribed
A. Simple server
#!/usr/bin/python
import socket # Import socket module
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) # Create a socket object
host = socket.gethostbyname(socket.gethostname()) # Get local machine name
port = 12345 # Reserve a port for your service.
s.bind((host, port)) # Bind to the port
print 'host ip', host
s.listen(5) # Now wait for client connection.
while True:
c, addr = s.accept() # Establish connection with client.
print 'Got connection from', addr
c.send('Thank you for connecting')
c.close() # Close the connection
B. Simple client
#!/usr/bin/python # This is client.py file
import socket # Import socket module
s = socket.socket() # Create a socket object
host = socket.gethostname() # Get local machine name/for this example
ports = 12345 #server port
portc = 32451 #client's own port for incoming connections (if any)
s.bind((host, portc))
s.connect((host, ports))
print s.recv(1024)
s.close # Close the socket when done
Lab 3: Error detection and recovery This lab focuses on detection of bit errors and recovering from such errors. Task: Generate a NxN matrix of bits, i.e., 0s and 1s only, at the client. The client transmits this matrix to the server. Before transmission, the client may induce a 1-bit error in the data at random. A 1-bit error means 1 is changed to 0 or 0 is changed to 1. Programming Tasks 1. Design and execute a program to detect all such 1-bit errors 2. Design an error correcting code so that the server can correct the 1 bit error

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis In Microsoft Excel

Authors: Alex Holloway

1st Edition

B0CCCPKTTX, 979-8852388452

More Books

Students also viewed these Databases questions

Question

4. Choose appropriate and powerful language

Answered: 1 week ago

Question

2. Choose an appropriate organizational pattern for your speech

Answered: 1 week ago