Re: Re: bind to IPv6 only?

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.cherrypy
Organization Providenza & Boekelheide, Inc.
Message-ID <[email protected]>
young-kyun Kim wrote:
> I do more trace this issue.

First, allow me to congratulate you on the thoroughness of your
analysis, and the detail in your description.  I'm not sure we will come
up with the answer, but you have certainly given us good information.


> To works well, check_port() in wait_for_occupied_port() must raise
> IOError.
> To check, I write the small test script refer to check_port() function
> in \Lib\site-packages\cherrypy\process\servers.py
> |
> importsocket
>
> #host = "::"
> host ="0:0:0:0:0:0:0:0"
> #host = "0.0.0.0"
> port =7070
> timeout =1.0
>
> info =socket.getaddrinfo(host,port,socket.AF_UNSPEC,
>                           socket.SOCK_STREAM)
>
> printinfo
>
> af,socktype,proto,canonname,sa =info[0]
>
> s =socket.socket(af,socktype,proto)
> s.settimeout(timeout)
> s.connect((host,port))
> s.close()
> |
>
> Above script works well on CentOS 7, python 2.7.5.

How can it possibly work well?  You can bind a TCP server to INADDR_ANY
so it listens on all available interfaces, but when you connect as a
client, you have to provide a specific IP address.  You are not
providing a valid host address.


> But error occurred on Win 8.1, python 2.7.11.
> |
> D:\test>testport.py
> [(23,1,0,'',('::',7070,0,0))]
> Traceback(most recent call last):
>   File"D:\test\testport.py",line 18,in<module>
>     s.connect((host,port))
>   File"C:\devtool\py27x86\lib\socket.py",line 228,inmeth
>     returngetattr(self._sock,name)(*args)
> socket.error:[Errno10049]
> |
>

That's what I would expect.  For what it's worth, 10049 is
WSAEADDRNOTAVAIL.  I suspect it would work if you specified ::1 as the
address.

-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.