2

Hello I'm trying to use protected http socks server with socket module as in the code shown below

>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> host = 'http://user:[email protected]'
>>> port = 8888
>>> s.bind((host, port))

It gives me error: socket.gaierror: [Errno -2] Name or service not known

Though if I setup proxy on a Firefox it works fine. What is in the code?

Sultan

1
  • 1
    I'm not familiar with protected http socks server, I think you mean either an authenticated HTTP Proxy or a SOCKS Proxy. The two different protocols can't easily be run on the same port. Which is it? Commented Sep 1, 2010 at 11:33

1 Answer 1

1

I believe your problem is because your host is malformed. The Socket host is just a name not a protocol. Your host should be something like:

host = 'server.com'

The authentication should be done after you connect, i.e., the first message you send is the authentication.

I can't give you the specifics of how to authenticate because that greatly depends on the server you are connecting to. Check this question

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.