New submission from Alexander Patrakov:

See the example at 
https://docs.python.org/2/library/socket.html#socket.getaddrinfo

>>> socket.getaddrinfo("www.python.org", 80, 0, 0, socket.SOL_TCP)

As I am primarily a C programmer, it is quite surprising for me to see a SOL_* 
being passed into the proto argument. I thought that SOL_* is only for 
setsockopt(), and IPPROTO_* would be suitable. Yes, for TCP and UDP the SOL_* 
and IPPROTO_* constants are the same, but see e.g. 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms737530%28v=vs.85%29.aspx
 which specifically points out that IPPROTO_* constants as acceptable values.

----------
assignee: docs@python
components: Documentation
messages: 225659
nosy: Alexander.Patrakov, docs@python
priority: normal
severity: normal
status: open
title: Possibly incorrect example is given for socket.getaddrinfo()
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22249>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to