• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #ifndef _WIN32
18 #error "Only include this header when building for Windows."
19 #endif
20 
21 #ifndef WIN32_LEAN_AND_MEAN
22 #define WIN32_LEAN_AND_MEAN 1
23 #endif
24 
25 // Default FD_SETSIZE is 64 which is not enough for us.
26 // Note: previously set to 1024, which was not enough, see:
27 //     https://code.google.com/p/android/issues/detail?id=102361
28 //
29 // The value 32768 is what a typical Winsock initialization returns
30 // as the maximum number of sockets, see #12 on the link above. Just assume
31 // that this translates to the max file descriptor number for our uses.
32 // Of course that also means each fd_set will be 4 KiB.
33 #define FD_SETSIZE 32768
34 
35 // Order of inclusion of winsock2.h and windows.h depends on the version
36 // of Mingw32 being used.
37 #include <winsock2.h>
38 #include <windows.h>
39 #include <ws2tcpip.h>
40 
41 #undef ERROR  // necessary to compile LOG(ERROR) statements.
42