Jan-09-2022, 10:53 PM
I managed to get this far on the code. It now works and strips out the information I want and presents it, but I'm now trying to figure out how to send the information received to another computer. I'm not sure how I'm supposed to send the information. I've tried a few different basic methods and now I'm stuck at this point: I tried creating a secondary socket figuring I had to in order to send the data forward to a different machine, but I've fought with getting different errors.
import socket, sys host = '' port = 65432 socksize = 19 host2 = '192.168.1.228:65431' socksize = 19 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host, port)) s.listen(1) print("Now listening...") def remove_punc(s): from_ = 'GET/&' to = ' ' translation = str.maketrans(from_,to) new = s.translate(translation) return ' '.join(new.split()) while True: conn, addr = s.accept() data = conn.recv(socksize) if not data: x=1 else: host2.send(bytes("Hey there!!", "utf-8")) #host2.send("data") data = data.decode('utf-8') print(data) print(remove_punc(data))