n distributed systems, most of the time the processing is based on client/server computing- the
client will request a service from the server and the server will process the service-request and
then send a reply to the client. The communication takes place over wired or wireless computer
networks.
In this lab project:You are a given a CSV file, and you should copy the file into some directory on
the server.
Using Python- you will import the CSV file and analyse the data frames (i.e. data structured as
columns and rows). To be able to do this - you need to install “pandas” on Python.
1. Write both TCP client and TCP server in Python version 3.8 or above.
2. Test the network connectivity between TCP client and TCP server.
3. Import the CSV file into the TCP server.
4. Find the number of rows and columns of the data set, and display the results on the TCP client
machine.
5. Output the 2
nd row on the TCP client machine.
from socket import *
import sys
import json
serverName = ""
serverPort = 6100
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect((serverName, serverPort))
sample_data = {
"Aparna" : 1,
"Pooja" : 2,
"Shreya" : 3,
"Tanishq" : 4
}
serialized_data = json.dumps(sample_data) #data serialized
# clientSocket.send(str.encode(sample_data))
clientSocket.send(str.encode(serialized_data))
response_data = clientSocket.recv(1024)
print("Response data from server : ", response_data.decode())
clientSocket.close()
Comments
Leave a comment