python sockets ########################### client.py import sockets = socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.connect((socket.gethostname() , 6666))print(socket.gethostname())print(33333333)first = Truefull_msg =''while True: msg =
Question:
python sockets
###########################
client.py
import sockets = socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.connect((socket.gethostname() , 6666))print(socket.gethostname())print("33333333")first = Truefull_msg =''while True: msg = s.recv(800) if len(msg) <= 0: break full_msg += msg.decode("utf-8") print(full_msg) if first == True: full_msg ='' first = False###########################################################
server.py import sockets = socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.bind((socket.gethostname() , 6666))print(socket.gethostname())print("33333333")s.listen(5) first = Truea = 0while a < 1: clientsocket, address = s.accept() if first == True: print(str(clientsocket) +"clientsocket") print(str(address) + "address") clientsocket.send(bytes("welcome to theserver","utf-8")) msg_to_client = input() clientsocket.send(bytes(msg_to_client,"utf-8")) first = False ####################################################
Statistics For Engineering And The Sciences
ISBN: 9781498728850
6th Edition
Authors: William M. Mendenhall, Terry L. Sincich