0

i'm faily new to python,

What i'm trying is to use sockets to connect to a web server. I want to use a proxy for this. I'm however not sure how to achieve this Can someone point me to the right direction?

I'll leave what i have below.

 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            s.connect((str(args.host), int(args.port)))
            s.send(str.encode(request)) 
            try:
                for y in range(150):
                    s.send(str.encode(request))
            except:
                s.close()
Niveus
  • 19
  • 2
  • Few clarifying questions. So you're trying to connect to a remote address and send some data? Where does the proxy come in? Why are you sending `request` 150 times? What is request (maybe show us where it's defined)? Do you mean to only close the socket when something goes wrong sending data (I'd expect you to always close it)? – nlta Jul 24 '21 at 04:33
  • [Python socket module. Connecting to an HTTP proxy then performing a GET request on an external resource](https://stackoverflow.com/questions/32792333/python-socket-module-connecting-to-an-http-proxy-then-performing-a-get-request) - it shows that you have to connect to proxy server and send request to proxy - and it will send it to web server - and when it get response from web server then it sends it to you. BTW: I found it in few seconds using Google `socket proxy python` - and you could the same and get it few hourse ago. – furas Jul 24 '21 at 07:45

0 Answers0