Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import pandas as pd
- def get_website(organization_name):
- data = pd.read_csv('organizations.csv')
- website = data[data['Name'] == organization_name]['Website'].values
- return website[0]
- def start_server():
- host = "127.0.0.32"
- port = 12345
- server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- server_socket.bind((host, port))
- server_socket.listen(1)
- while True:
- client_socket, address = server_socket.accept()
- data = client_socket.recv(1024)
- message = data.decode()
- if message == "exit":
- break
- website = get_website(message)
- client_socket.send(website.encode())
- client_socket.close()
- if __name__ == "__main__":
- start_server()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement