On Fri, 21 Dec 2007 15:38:03 +1100, Astan Chee <[EMAIL PROTECTED]> wrote: >Hi, I have a proxy server that requires authentication on a non-standard >port and Im trying to connect to it via socket.connect() >I tried doing this: >import socket >server = ("username:[EMAIL PROTECTED]",1234) >s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) >s.connect(server) > >I keep getting the > >Traceback (most recent call last): > File "<pyshell#6>", line 1, in <module> > s.connect(server) > File "<string>", line 1, in connect >gaierror: (11001, 'getaddrinfo failed') > >What does this mean? and can I actually use username/password to connect >using a socket in python?
You can't specify credentials to a proxy this way. The first element of the address tuple for an AF_INET socket is a hostname or IP address. If you have a proxy which requires authentication, you must authenticate after you have established the connection by sending bytes over the socket. I don't know what kind of proxy you have, so I don't know what bytes you have to send. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list