Answer the question
In order to leave comments, you need to log in
How to get information from raw python sockets?
Good afternoon. There is a proxy server in python.
In this piece, the reception and transmission of data.
Considering that the proxy server is aimed at working with HTTP/HTTPS protocols, how to decode/translate the "data" variable into a readable form?
def _read_write(self):
time_out_max = self.timeout/3
socs = [self.client, self.target]
count = 0
while 1:
count += 1
(recv, _, error) = select.select(socs, [], socs, 3)
if error:
break
if recv:
for in_ in recv:
data = in_.recv(BUFLEN)
if in_ is self.client:
out = self.target
else:
out = self.client
if data:
out.send(data)
count = 0
if count == time_out_max:
break
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question