Skip to content

Conversation

mstorsjo
Copy link
Contributor

@mstorsjo mstorsjo commented Oct 1, 2015

This fixes "make dummy".

@ncm ncm merged commit bd18664 into ncm:master Mar 30, 2016
@mstorsjo mstorsjo deleted the dummy-headers branch March 30, 2016 18:49
@DimitriPapadopoulos
Copy link

DimitriPapadopoulos commented Dec 28, 2021

Why is ws2tcpip.h use instead of winsock2.h?

According to the latest Programming reference for the Win32 API, all the functions used here are defined in the winsock2.h header.

MinGW also defines these functions in the winsock2.h header:
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/include/winsock2.h

Of course I do understand that ws2tcpip.h includes ẁinsock2.h and defines additional functions resulting in a more modern API, but the minimal header required here is winsock2.h:
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/include/ws2tcpip.h#l17

#include <winsock2.h>

Ah, got it! This code defines a socklen_t variable. which is then passed to getsockname(). But then the signature of getsockname() is:

int WSAAPI getsockname(
  [in]      SOCKET   s,
  [out]     sockaddr *name,
  [in, out] int      *namelen
);

I looks like int is sufficient. Do we really need socklen_t here?

@DimitriPapadopoulos
Copy link

I don't think we need socklen_t, see #5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants