#!/usr/bin/python3 # -*- coding: utf-8 -*- import socket server_port = 12000 # Create a socket object (defaults to AF_INET and SOCK_STREAM) # IF_INET says IPv4, and SOCK_STREAM says TCP server_socket = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) # server does not need to know its own IP server_socket.bind(("", server_port)) # Argument specifies the number of unaccepted connections # that the system will allow before refusing new connections. server_socket.listen(2) print("The server is ready to receive") while True: connection_socket, addr = server_socket.accept() print("client connection_socket address:", addr) sentence = connection_socket.recv(1024) capitalized_sentence = sentence.decode().upper() connection_socket.send(capitalized_sentence.encode()) connection_socket.close()