Bugs item #1482328, was opened at 2006-05-05 12:22 Message generated for change (Comment added) made by gangesmaster You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1482328&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: ganges master (gangesmaster) Assigned to: Nobody/Anonymous (nobody) Summary: socket.getsockopt bug Initial Comment: i tested this on windows xp. the installed python version is the 2.4.3 from the windows MSI. when doing socket.getsockopt with buffer_size > 0, for options like SO_LINGER or SO_SNDTIMEO, i get only 4 bytes. although the man pages state these options hold 8 bytes. is this a bug in the pythonic version of getsockopt or winsock? -tomer ---------------------------------------------------------------------- >Comment By: ganges master (gangesmaster) Date: 2006-05-05 16:43 Message: Logged In: YES user_id=1406776 i don't think so: according to http://www.sockets.com/winsock.htm#GetSockOpt and http://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html struct linger is defined this way: struct linger { int l_onoff; int l_linger; } which means 8 bytes, and the same goes for struct timeval: struct timeval { long tv_sec; long tv_usec; }; still, the getsockopt returns only 4. i looked at the python source but i can't find the bug... perhaps its a bug with how they use winsock? -tomer ---------------------------------------------------------------------- Comment By: Matt Fleming (splitscreen) Date: 2006-05-05 16:12 Message: Logged In: YES user_id=1126061 According to http://www.sockets.com/winsock.htm#GetSockOpt "The integer pointed to by optlen should originally contain the size of this buffer; on return, it will be set to the size of the value returned. For SO_LINGER, this will be the size of a struct linger; for all other options it will be the size of an integer." The size of a linger struct is 4 bytes. I would agree that the Python documentation for socket.getsockopt is a little confusing. "Get a socket option. See the Unix manual for level and option. If a nonzero buffersize argument is given, the return value is a string of that length; otherwise it is an integer." Perhaps just refer users to the OSes documentation on its implementation of sockets? Matt ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1482328&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com