author | Johannes Sixt <johannes.sixt@telecom.at> | |
Wed, 26 Dec 2007 12:51:18 +0000 (13:51 +0100) | ||
committer | Johannes Sixt <johannes.sixt@telecom.at> | |
Thu, 26 Jun 2008 06:45:09 +0000 (08:45 +0200) | ||
commit | 746fb8574459798d127e3f9cf782ccb8e31c9e45 | |
tree | e1c59cd794cedc573f4a2ee81ae9291277d9bdce | tree | snapshot |
parent | 87bddba9924045e39e988d9704714db90abd5619 | commit | diff |
Windows: Implement wrappers for gethostbyname(), socket(), and connect().
gethostbyname() is the first function that calls into the Winsock library,
and it is wrapped only to initialize the library.
socket() is wrapped for two reasons:
- Windows's socket() creates things that are like low-level file handles,
and they must be converted into file descriptors first.
- And these handles cannot be used with plain ReadFile()/WriteFile()
because they are opened for "overlapped IO". We have to use WSASocket()
to create non-overlapped IO sockets.
connect() must be wrapped because Windows's connect() expects the low-level
sockets, not file descriptors, and we must first unwrap the file descriptor
before we can pass it on to Windows's connect().
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
gethostbyname() is the first function that calls into the Winsock library,
and it is wrapped only to initialize the library.
socket() is wrapped for two reasons:
- Windows's socket() creates things that are like low-level file handles,
and they must be converted into file descriptors first.
- And these handles cannot be used with plain ReadFile()/WriteFile()
because they are opened for "overlapped IO". We have to use WSASocket()
to create non-overlapped IO sockets.
connect() must be wrapped because Windows's connect() expects the low-level
sockets, not file descriptors, and we must first unwrap the file descriptor
before we can pass it on to Windows's connect().
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
compat/mingw.c | diff | blob | history | |
compat/mingw.h | diff | blob | history |