Re: Re: bind to IPv6 only?

young-kyun Kim <[email protected]>
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>

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
> import socket
>
> #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)
>
> print info
>
> 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.

Also, I agree with your opinon .
But, I did test many times and the result is same.
My test script don't raise any exception on my CentOS 7 test machine.

2016년 3월 30일 수요일 오전 1시 50분 26초 UTC+9, Tim Roberts 님의 말:
>
> 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
> import socket
>
> #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)
>
> print info
>
> 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, in meth
>     return getattr(self._sock,name)(*args)
> socket.error: [Errno 10049]
>
>
> 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] <javascript:>
> 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.