Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

unexpected optlen size from getsockopt on Windows 7

$
0
0

I'm porting some code that works when compiled with VS.NET 2003 and run under XP but has different results when compiled with VS 2012 and run under Windows 7.

     int l_BufferSize = sizeof( BOOL );
    char l_pNagle[sizeof( BOOL )];

    int result = getsockopt( m_Socket,
                          IPPROTO_TCP,
                          TCP_NODELAY,
                          l_pNagle,
                          &l_BufferSize );
    assert( sizeof( BOOL ) == static_cast<unsigned int>( l_BufferSize ) );

The documentation for getsockopt says the size of the buffer needed to contain the TCP_NODELAY data is the size of a BOOL. Under XP this was 4 bytes. Under Win 7 it appears to be 1 byte.

Is this the correct size and the documentation is out of date or am I experiencing a bug.

Thanks for any help.


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>