Question
Client: tcp_ip = '192.168.1.6' tcp_port = 62 buf_size = 1024 msg = Hello, World! b = bytearray() b.extend(map(ord, msg)) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((tcp_ip, tcp_port))
Client:
tcp_ip = '192.168.1.6' tcp_port = 62 buf_size = 1024 msg = "Hello, World!" b = bytearray() b.extend(map(ord, msg))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((tcp_ip, tcp_port)) s.send(b) s.close()
Server:
tcp_ip = '192.168.1.6' tcp_port = 5005 buf_size = 20
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((tcp_ip, tcp_port)) s.listen(1)
conn, addr = s.accept() print ('Connection address:', addr) while 1: data = conn.recv(buf_size) if not data: break print ("received data:", data) conn.close()
How can i change one of these programs so more than just the one "hello message" is sent. Make it so multiple messages can be sent
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started