Artifact d9a5a4e6dafa45cb27e1778a31bcb92f7b31c33f:
- File
src/win32/winsock.d
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
The problem was __gshared. Replacing it with TLS fixed the issue. Remaining problem is that "hack.d"'s CloseHandle hack is not working anymore.
(user: kinaba) [annotate]
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a /*************** 0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0040: 2a 2a 2a 2a 2a 2a 2a 2a 5c 0d 0a 2a 20 20 20 20 ********\..* 0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0060: 20 20 20 20 20 20 20 20 20 20 20 77 69 6e 73 6f winso 0070: 63 6b 2e 64 20 20 20 20 20 20 20 20 20 20 20 20 ck.d 0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0090: 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 20 *..* 00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0d *. 00e0: 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .* 00f0: 20 20 20 20 20 20 20 20 20 57 69 6e 64 6f 77 73 Windows 0100: 20 41 50 49 20 68 65 61 64 65 72 20 6d 6f 64 75 API header modu 0110: 6c 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 le 0120: 20 20 20 20 20 20 20 20 20 2a 0d 0a 2a 20 20 20 *..* 0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0170: 20 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 *..* 0180: 20 20 20 20 20 20 20 20 20 54 72 61 6e 73 6c 61 Transla 0190: 74 65 64 20 66 72 6f 6d 20 4d 69 6e 47 57 20 57 ted from MinGW W 01a0: 69 6e 64 6f 77 73 20 68 65 61 64 65 72 73 20 20 indows headers 01b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a * 01c0: 0d 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 ..* 01d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 79 by 01e0: 20 53 74 65 77 61 72 74 20 47 6f 72 64 6f 6e 20 Stewart Gordon 01f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0200: 20 20 20 20 20 20 20 20 20 20 2a 0d 0a 5c 2a 2a *..\** 0210: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0220: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0230: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0240: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0250: 2a 2a 2a 2a 2a 2f 0d 0a 6d 6f 64 75 6c 65 20 77 *****/..module w 0260: 69 6e 33 32 2e 77 69 6e 73 6f 63 6b 3b 0d 0a 0d in32.winsock;... 0270: 0a 2f 2a 0d 0a 20 20 44 65 66 69 6e 69 74 69 6f ./*.. Definitio 0280: 6e 73 20 66 6f 72 20 77 69 6e 73 6f 63 6b 20 31 ns for winsock 1 0290: 2e 31 0d 0a 0d 0a 20 20 50 6f 72 74 69 6f 6e 73 .1.... Portions 02a0: 20 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 31 Copyright (c) 1 02b0: 39 38 30 2c 20 31 39 38 33 2c 20 31 39 38 38 2c 980, 1983, 1988, 02c0: 20 31 39 39 33 0d 0a 20 20 54 68 65 20 52 65 67 1993.. The Reg 02d0: 65 6e 74 73 20 6f 66 20 74 68 65 20 55 6e 69 76 ents of the Univ 02e0: 65 72 73 69 74 79 20 6f 66 20 43 61 6c 69 66 6f ersity of Califo 02f0: 72 6e 69 61 2e 20 20 41 6c 6c 20 72 69 67 68 74 rnia. All right 0300: 73 20 72 65 73 65 72 76 65 64 2e 0d 0a 0d 0a 20 s reserved..... 0310: 20 50 6f 72 74 69 6f 6e 73 20 43 6f 70 79 72 69 Portions Copyri 0320: 67 68 74 20 28 63 29 20 31 39 39 33 20 62 79 20 ght (c) 1993 by 0330: 44 69 67 69 74 61 6c 20 45 71 75 69 70 6d 65 6e Digital Equipmen 0340: 74 20 43 6f 72 70 6f 72 61 74 69 6f 6e 2e 0d 0a t Corporation... 0350: 20 2a 2f 0d 0a 0d 0a 2f 2a 09 44 52 4b 3a 20 54 */..../*.DRK: T 0360: 68 69 73 20 6d 6f 64 75 6c 65 20 73 68 6f 75 6c his module shoul 0370: 64 20 6e 6f 74 20 62 65 20 69 6e 63 6c 75 64 65 d not be include 0380: 64 20 69 66 20 2d 76 65 72 73 69 6f 6e 3d 57 69 d if -version=Wi 0390: 6e 33 32 5f 57 69 6e 73 6f 63 6b 32 20 68 61 73 n32_Winsock2 has 03a0: 0d 0a 20 2a 09 62 65 65 6e 20 73 65 74 2e 20 20 .. *.been set. 03b0: 49 66 20 69 74 20 68 61 73 2c 20 61 73 73 65 72 If it has, asser 03c0: 74 2e 20 20 49 20 74 68 69 6e 6b 20 69 74 27 73 t. I think it's 03d0: 20 62 65 74 74 65 72 20 74 68 61 74 20 77 61 79 better that way 03e0: 20 74 68 61 6e 20 6c 65 74 74 69 6e 67 0d 0a 20 than letting.. 03f0: 2a 09 74 68 65 20 75 73 65 72 20 62 65 6c 69 65 *.the user belie 0400: 76 65 20 74 68 61 74 20 69 74 27 73 20 77 6f 72 ve that it's wor 0410: 6b 65 64 2e 0d 0a 20 2a 0d 0a 20 2a 09 53 47 3a ked... *.. *.SG: 0420: 20 49 74 20 68 61 73 20 6e 6f 77 20 62 65 65 6e It has now been 0430: 20 63 68 61 6e 67 65 64 20 73 6f 20 74 68 61 74 changed so that 0440: 20 77 69 6e 73 6f 63 6b 32 20 69 73 20 74 68 65 winsock2 is the 0450: 20 64 65 66 61 75 6c 74 2c 20 61 6e 64 0d 0a 20 default, and.. 0460: 2a 09 2d 76 65 72 73 69 6f 6e 3d 57 69 6e 33 32 *.-version=Win32 0470: 5f 57 69 6e 73 6f 63 6b 31 20 6d 75 73 74 20 62 _Winsock1 must b 0480: 65 20 73 65 74 20 74 6f 20 75 73 65 20 77 69 6e e set to use win 0490: 73 6f 63 6b 2e 0d 0a 20 2a 2f 0d 0a 76 65 72 73 sock... */..vers 04a0: 69 6f 6e 28 57 69 6e 33 32 5f 57 69 6e 73 6f 63 ion(Win32_Winsoc 04b0: 6b 31 29 20 7b 7d 0d 0a 65 6c 73 65 20 7b 0d 0a k1) {}..else {.. 04c0: 20 20 20 20 70 72 61 67 6d 61 28 6d 73 67 2c 20 pragma(msg, 04d0: 22 43 61 6e 6e 6f 74 20 75 73 65 20 77 69 6e 33 "Cannot use win3 04e0: 32 2e 77 69 6e 73 6f 63 6b 20 77 69 74 68 6f 75 2.winsock withou 04f0: 74 20 22 0d 0a 09 09 09 7e 20 22 57 69 6e 33 32 t ".....~ "Win32 0500: 5f 57 69 6e 73 6f 63 6b 31 20 64 65 66 69 6e 65 _Winsock1 define 0510: 64 2e 22 29 3b 0d 0a 20 20 20 20 73 74 61 74 69 d.");.. stati 0520: 63 20 61 73 73 65 72 74 28 66 61 6c 73 65 29 3b c assert(false); 0530: 0d 0a 7d 0d 0a 0d 0a 69 6d 70 6f 72 74 20 77 69 ..}....import wi 0540: 6e 33 32 2e 77 69 6e 64 65 66 3b 0d 0a 0d 0a 61 n32.windef;....a 0550: 6c 69 61 73 20 63 68 61 72 20 75 5f 63 68 61 72 lias char u_char 0560: 3b 0d 0a 61 6c 69 61 73 20 75 73 68 6f 72 74 20 ;..alias ushort 0570: 75 5f 73 68 6f 72 74 3b 0d 0a 61 6c 69 61 73 20 u_short;..alias 0580: 75 69 6e 74 20 75 5f 69 6e 74 2c 20 75 5f 6c 6f uint u_int, u_lo 0590: 6e 67 2c 20 53 4f 43 4b 45 54 3b 0d 0a 0d 0a 63 ng, SOCKET;....c 05a0: 6f 6e 73 74 20 73 69 7a 65 5f 74 20 46 44 5f 53 onst size_t FD_S 05b0: 45 54 53 49 5a 45 20 3d 20 36 34 3b 0d 0a 0d 0a ETSIZE = 64;.... 05c0: 2f 2f 20 73 68 75 74 64 6f 77 6e 28 29 20 68 6f // shutdown() ho 05d0: 77 20 74 79 70 65 73 0d 0a 65 6e 75 6d 20 3a 20 w types..enum : 05e0: 69 6e 74 20 7b 0d 0a 09 53 44 5f 52 45 43 45 49 int {...SD_RECEI 05f0: 56 45 2c 0d 0a 09 53 44 5f 53 45 4e 44 2c 0d 0a VE,...SD_SEND,.. 0600: 09 53 44 5f 42 4f 54 48 0d 0a 7d 0d 0a 0d 0a 73 .SD_BOTH..}....s 0610: 74 72 75 63 74 20 46 44 5f 53 45 54 20 7b 0d 0a truct FD_SET {.. 0620: 09 75 5f 69 6e 74 20 20 20 20 20 20 20 20 20 20 .u_int 0630: 20 20 20 20 66 64 5f 63 6f 75 6e 74 3b 0d 0a 09 fd_count;... 0640: 53 4f 43 4b 45 54 5b 46 44 5f 53 45 54 53 49 5a SOCKET[FD_SETSIZ 0650: 45 5d 20 66 64 5f 61 72 72 61 79 3b 0d 0a 0d 0a E] fd_array;.... 0660: 09 73 74 61 74 69 63 20 76 6f 69 64 20 6f 70 43 .static void opC 0670: 61 6c 6c 28 53 4f 43 4b 45 54 20 66 64 2c 20 46 all(SOCKET fd, F 0680: 44 5f 53 45 54 2a 20 73 65 74 29 20 7b 0d 0a 09 D_SET* set) {... 0690: 09 69 66 20 28 73 65 74 2e 66 64 5f 63 6f 75 6e .if (set.fd_coun 06a0: 74 20 3c 20 46 44 5f 53 45 54 53 49 5a 45 29 20 t < FD_SETSIZE) 06b0: 73 65 74 2e 66 64 5f 61 72 72 61 79 5b 73 65 74 set.fd_array[set 06c0: 2e 66 64 5f 63 6f 75 6e 74 2b 2b 5d 20 3d 20 66 .fd_count++] = f 06d0: 64 3b 0d 0a 09 7d 0d 0a 7d 0d 0a 61 6c 69 61 73 d;...}..}..alias 06e0: 20 46 44 5f 53 45 54 2a 20 50 46 44 5f 53 45 54 FD_SET* PFD_SET 06f0: 2c 20 4c 50 46 44 5f 53 45 54 3b 0d 0a 0d 0a 65 , LPFD_SET;....e 0700: 78 74 65 72 6e 28 50 61 73 63 61 6c 29 20 69 6e xtern(Pascal) in 0710: 74 20 5f 5f 57 53 41 46 44 49 73 53 65 74 28 53 t __WSAFDIsSet(S 0720: 4f 43 4b 45 54 2c 20 46 44 5f 53 45 54 2a 29 3b OCKET, FD_SET*); 0730: 0d 0a 61 6c 69 61 73 20 5f 5f 57 53 41 46 44 49 ..alias __WSAFDI 0740: 73 53 65 74 20 46 44 5f 49 53 53 45 54 3b 0d 0a sSet FD_ISSET;.. 0750: 0d 0a 76 6f 69 64 20 46 44 5f 43 4c 52 28 53 4f ..void FD_CLR(SO 0760: 43 4b 45 54 20 66 64 2c 20 46 44 5f 53 45 54 2a CKET fd, FD_SET* 0770: 20 73 65 74 29 20 7b 0d 0a 09 66 6f 72 20 28 75 set) {...for (u 0780: 5f 69 6e 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 _int i = 0; i < 0790: 73 65 74 2e 66 64 5f 63 6f 75 6e 74 3b 20 69 2b set.fd_count; i+ 07a0: 2b 29 20 7b 0d 0a 09 09 69 66 20 28 73 65 74 2e +) {....if (set. 07b0: 66 64 5f 61 72 72 61 79 5b 69 5d 20 3d 3d 20 66 fd_array[i] == f 07c0: 64 29 20 7b 0d 0a 09 09 09 77 68 69 6c 65 20 28 d) {.....while ( 07d0: 69 20 3c 20 73 65 74 2e 66 64 5f 63 6f 75 6e 74 i < set.fd_count 07e0: 20 2d 20 31 29 20 7b 0d 0a 09 09 09 09 73 65 74 - 1) {......set 07f0: 2e 66 64 5f 61 72 72 61 79 5b 69 5d 20 3d 20 73 .fd_array[i] = s 0800: 65 74 2e 66 64 5f 61 72 72 61 79 5b 69 2b 31 5d et.fd_array[i+1] 0810: 3b 0d 0a 09 09 09 09 69 2b 2b 3b 0d 0a 09 09 09 ;......i++;..... 0820: 7d 0d 0a 09 09 09 73 65 74 2e 66 64 5f 63 6f 75 }.....set.fd_cou 0830: 6e 74 2d 2d 3b 0d 0a 09 09 09 62 72 65 61 6b 3b nt--;.....break; 0840: 0d 0a 09 09 7d 0d 0a 09 7d 0d 0a 7d 0d 0a 0d 0a ....}...}..}.... 0850: 2f 2b 76 6f 69 64 20 46 44 5f 53 45 54 28 53 4f /+void FD_SET(SO 0860: 43 4b 45 54 20 66 64 2c 20 46 44 5f 53 45 54 2a CKET fd, FD_SET* 0870: 20 73 65 74 29 20 7b 0d 0a 09 69 66 20 28 73 65 set) {...if (se 0880: 74 2e 66 64 5f 63 6f 75 6e 74 20 3c 20 46 44 5f t.fd_count < FD_ 0890: 53 45 54 53 49 5a 45 29 20 73 65 74 2e 66 64 5f SETSIZE) set.fd_ 08a0: 61 72 72 61 79 5b 73 65 74 2e 66 64 5f 63 6f 75 array[set.fd_cou 08b0: 6e 74 2b 2b 5d 20 3d 20 66 64 3b 0d 0a 7d 2b 2f nt++] = fd;..}+/ 08c0: 0d 0a 0d 0a 76 6f 69 64 20 46 44 5f 5a 45 52 4f ....void FD_ZERO 08d0: 28 46 44 5f 53 45 54 2a 20 73 65 74 29 20 7b 0d (FD_SET* set) {. 08e0: 0a 09 73 65 74 2e 66 64 5f 63 6f 75 6e 74 20 3d ..set.fd_count = 08f0: 20 30 3b 0d 0a 7d 0d 0a 0d 0a 0d 0a 73 74 72 75 0;..}......stru 0900: 63 74 20 54 49 4d 45 56 41 4c 20 7b 0d 0a 09 69 ct TIMEVAL {...i 0910: 6e 74 20 74 76 5f 73 65 63 3b 0d 0a 09 69 6e 74 nt tv_sec;...int 0920: 20 74 76 5f 75 73 65 63 3b 0d 0a 0d 0a 09 69 6e tv_usec;.....in 0930: 74 20 6f 70 43 6d 70 28 54 49 4d 45 56 41 4c 20 t opCmp(TIMEVAL 0940: 74 76 29 20 7b 0d 0a 09 09 69 66 20 28 74 76 5f tv) {....if (tv_ 0950: 73 65 63 20 3c 20 74 76 2e 74 76 5f 73 65 63 29 sec < tv.tv_sec) 0960: 20 20 20 72 65 74 75 72 6e 20 2d 31 3b 0d 0a 09 return -1;... 0970: 09 69 66 20 28 74 76 5f 73 65 63 20 3e 20 74 76 .if (tv_sec > tv 0980: 2e 74 76 5f 73 65 63 29 20 20 20 72 65 74 75 72 .tv_sec) retur 0990: 6e 20 20 31 3b 0d 0a 09 09 69 66 20 28 74 76 5f n 1;....if (tv_ 09a0: 75 73 65 63 20 3c 20 74 76 2e 74 76 5f 75 73 65 usec < tv.tv_use 09b0: 63 29 20 72 65 74 75 72 6e 20 2d 31 3b 0d 0a 09 c) return -1;... 09c0: 09 69 66 20 28 74 76 5f 75 73 65 63 20 3e 20 74 .if (tv_usec > t 09d0: 76 2e 74 76 5f 75 73 65 63 29 20 72 65 74 75 72 v.tv_usec) retur 09e0: 6e 20 20 31 3b 0d 0a 09 09 72 65 74 75 72 6e 20 n 1;....return 09f0: 30 3b 0d 0a 09 7d 0d 0a 7d 0d 0a 61 6c 69 61 73 0;...}..}..alias 0a00: 20 54 49 4d 45 56 41 4c 2a 20 50 54 49 4d 45 56 TIMEVAL* PTIMEV 0a10: 41 4c 2c 20 4c 50 54 49 4d 45 56 41 4c 3b 0d 0a AL, LPTIMEVAL;.. 0a20: 0d 0a 62 6f 6f 6c 20 74 69 6d 65 72 69 73 73 65 ..bool timerisse 0a30: 74 28 54 49 4d 45 56 41 4c 20 74 76 70 29 20 7b t(TIMEVAL tvp) { 0a40: 0d 0a 09 72 65 74 75 72 6e 20 74 76 70 2e 74 76 ...return tvp.tv 0a50: 5f 73 65 63 20 7c 7c 20 74 76 70 2e 74 76 5f 75 _sec || tvp.tv_u 0a60: 73 65 63 3b 0d 0a 7d 0d 0a 0d 0a 76 6f 69 64 20 sec;..}....void 0a70: 74 69 6d 65 72 63 6c 65 61 72 28 72 65 66 20 54 timerclear(ref T 0a80: 49 4d 45 56 41 4c 20 74 76 70 29 20 7b 0d 0a 09 IMEVAL tvp) {... 0a90: 74 76 70 2e 74 76 5f 73 65 63 20 3d 20 74 76 70 tvp.tv_sec = tvp 0aa0: 2e 74 76 5f 75 73 65 63 20 3d 20 30 3b 0d 0a 7d .tv_usec = 0;..} 0ab0: 0d 0a 0d 0a 73 74 72 75 63 74 20 48 4f 53 54 45 ....struct HOSTE 0ac0: 4e 54 20 7b 0d 0a 09 63 68 61 72 2a 20 20 68 5f NT {...char* h_ 0ad0: 6e 61 6d 65 3b 0d 0a 09 63 68 61 72 2a 2a 20 68 name;...char** h 0ae0: 5f 61 6c 69 61 73 65 73 3b 0d 0a 09 73 68 6f 72 _aliases;...shor 0af0: 74 20 20 68 5f 61 64 64 72 74 79 70 65 3b 0d 0a t h_addrtype;.. 0b00: 09 73 68 6f 72 74 20 20 68 5f 6c 65 6e 67 74 68 .short h_length 0b10: 3b 0d 0a 09 63 68 61 72 2a 2a 20 68 5f 61 64 64 ;...char** h_add 0b20: 72 5f 6c 69 73 74 3b 0d 0a 0d 0a 09 63 68 61 72 r_list;.....char 0b30: 2a 20 68 5f 61 64 64 72 28 29 20 7b 20 72 65 74 * h_addr() { ret 0b40: 75 72 6e 20 68 5f 61 64 64 72 5f 6c 69 73 74 5b urn h_addr_list[ 0b50: 30 5d 3b 20 7d 0d 0a 09 63 68 61 72 2a 20 68 5f 0]; }...char* h_ 0b60: 61 64 64 72 28 63 68 61 72 2a 20 68 29 20 7b 20 addr(char* h) { 0b70: 72 65 74 75 72 6e 20 68 5f 61 64 64 72 5f 6c 69 return h_addr_li 0b80: 73 74 5b 30 5d 20 3d 20 68 3b 20 7d 0d 0a 7d 0d st[0] = h; }..}. 0b90: 0a 61 6c 69 61 73 20 48 4f 53 54 45 4e 54 2a 20 .alias HOSTENT* 0ba0: 50 48 4f 53 54 45 4e 54 2c 20 4c 50 48 4f 53 54 PHOSTENT, LPHOST 0bb0: 45 4e 54 3b 0d 0a 0d 0a 73 74 72 75 63 74 20 4c ENT;....struct L 0bc0: 49 4e 47 45 52 20 7b 0d 0a 09 75 5f 73 68 6f 72 INGER {...u_shor 0bd0: 74 20 6c 5f 6f 6e 6f 66 66 3b 0d 0a 09 75 5f 73 t l_onoff;...u_s 0be0: 68 6f 72 74 20 6c 5f 6c 69 6e 67 65 72 3b 0d 0a hort l_linger;.. 0bf0: 7d 0d 0a 61 6c 69 61 73 20 4c 49 4e 47 45 52 2a }..alias LINGER* 0c00: 20 50 4c 49 4e 47 45 52 2c 20 4c 50 4c 49 4e 47 PLINGER, LPLING 0c10: 45 52 3b 0d 0a 0d 0a 2f 2f 20 54 4f 54 48 49 4e ER;....// TOTHIN 0c20: 4b 41 42 4f 55 54 3a 20 64 6f 20 77 65 20 6e 65 KABOUT: do we ne 0c30: 65 64 20 74 68 65 73 65 2c 20 6f 72 20 61 72 65 ed these, or are 0c40: 20 74 68 65 79 20 6a 75 73 74 20 66 6f 72 20 69 they just for i 0c50: 6e 74 65 72 6e 61 6c 20 75 73 65 3f 0d 0a 2f 2b nternal use?../+ 0c60: 0d 0a 23 64 65 66 69 6e 65 20 49 4f 43 50 41 52 ..#define IOCPAR 0c70: 4d 5f 4d 41 53 4b 09 30 78 37 66 0d 0a 23 64 65 M_MASK.0x7f..#de 0c80: 66 69 6e 65 20 49 4f 43 5f 56 4f 49 44 09 30 78 fine IOC_VOID.0x 0c90: 32 30 30 30 30 30 30 30 0d 0a 23 64 65 66 69 6e 20000000..#defin 0ca0: 65 20 49 4f 43 5f 4f 55 54 09 30 78 34 30 30 30 e IOC_OUT.0x4000 0cb0: 30 30 30 30 0d 0a 23 64 65 66 69 6e 65 20 49 4f 0000..#define IO 0cc0: 43 5f 49 4e 09 30 78 38 30 30 30 30 30 30 30 0d C_IN.0x80000000. 0cd0: 0a 23 64 65 66 69 6e 65 20 49 4f 43 5f 49 4e 4f .#define IOC_INO 0ce0: 55 54 09 28 49 4f 43 5f 49 4e 7c 49 4f 43 5f 4f UT.(IOC_IN|IOC_O 0cf0: 55 54 29 0d 0a 0d 0a 23 64 65 66 69 6e 65 20 5f UT)....#define _ 0d00: 49 4f 28 78 2c 79 29 09 28 49 4f 43 5f 56 4f 49 IO(x,y).(IOC_VOI 0d10: 44 7c 28 28 78 29 3c 3c 38 29 7c 28 79 29 29 0d D|((x)<<8)|(y)). 0d20: 0a 23 64 65 66 69 6e 65 20 5f 49 4f 52 28 78 2c .#define _IOR(x, 0d30: 79 2c 74 29 09 28 49 4f 43 5f 4f 55 54 7c 28 28 y,t).(IOC_OUT|(( 0d40: 28 69 6e 74 29 73 69 7a 65 6f 66 28 74 29 26 49 (int)sizeof(t)&I 0d50: 4f 43 50 41 52 4d 5f 4d 41 53 4b 29 3c 3c 31 36 OCPARM_MASK)<<16 0d60: 29 7c 28 28 78 29 3c 3c 38 29 7c 28 79 29 29 0d )|((x)<<8)|(y)). 0d70: 0a 23 64 65 66 69 6e 65 20 5f 49 4f 57 28 78 2c .#define _IOW(x, 0d80: 79 2c 74 29 09 28 49 4f 43 5f 49 4e 7c 28 28 28 y,t).(IOC_IN|((( 0d90: 69 6e 74 29 73 69 7a 65 6f 66 28 74 29 26 49 4f int)sizeof(t)&IO 0da0: 43 50 41 52 4d 5f 4d 41 53 4b 29 3c 3c 31 36 29 CPARM_MASK)<<16) 0db0: 7c 28 28 78 29 3c 3c 38 29 7c 28 79 29 29 0d 0a |((x)<<8)|(y)).. 0dc0: 0d 0a 23 64 65 66 69 6e 65 20 46 49 4f 4e 42 49 ..#define FIONBI 0dd0: 4f 09 5f 49 4f 57 28 27 66 27 2c 20 31 32 36 2c O._IOW('f', 126, 0de0: 20 75 5f 6c 6f 6e 67 29 0d 0a 23 64 65 66 69 6e u_long)..#defin 0df0: 65 20 46 49 4f 4e 52 45 41 44 09 5f 49 4f 52 28 e FIONREAD._IOR( 0e00: 27 66 27 2c 20 31 32 37 2c 20 75 5f 6c 6f 6e 67 'f', 127, u_long 0e10: 29 0d 0a 23 64 65 66 69 6e 65 20 46 49 4f 41 53 )..#define FIOAS 0e20: 59 4e 43 09 5f 49 4f 57 28 27 66 27 2c 20 31 32 YNC._IOW('f', 12 0e30: 35 2c 20 75 5f 6c 6f 6e 67 29 0d 0a 23 64 65 66 5, u_long)..#def 0e40: 69 6e 65 20 53 49 4f 43 53 48 49 57 41 54 09 5f ine SIOCSHIWAT._ 0e50: 49 4f 57 28 27 73 27 2c 20 20 30 2c 20 75 5f 6c IOW('s', 0, u_l 0e60: 6f 6e 67 29 0d 0a 23 64 65 66 69 6e 65 20 53 49 ong)..#define SI 0e70: 4f 43 47 48 49 57 41 54 09 5f 49 4f 52 28 27 73 OCGHIWAT._IOR('s 0e80: 27 2c 20 20 31 2c 20 75 5f 6c 6f 6e 67 29 0d 0a ', 1, u_long).. 0e90: 23 64 65 66 69 6e 65 20 53 49 4f 43 53 4c 4f 57 #define SIOCSLOW 0ea0: 41 54 09 5f 49 4f 57 28 27 73 27 2c 20 20 32 2c AT._IOW('s', 2, 0eb0: 20 75 5f 6c 6f 6e 67 29 0d 0a 23 64 65 66 69 6e u_long)..#defin 0ec0: 65 20 53 49 4f 43 47 4c 4f 57 41 54 09 5f 49 4f e SIOCGLOWAT._IO 0ed0: 52 28 27 73 27 2c 20 20 33 2c 20 75 5f 6c 6f 6e R('s', 3, u_lon 0ee0: 67 29 0d 0a 23 64 65 66 69 6e 65 20 53 49 4f 43 g)..#define SIOC 0ef0: 41 54 4d 41 52 4b 09 5f 49 4f 52 28 27 73 27 2c ATMARK._IOR('s', 0f00: 20 20 37 2c 20 75 5f 6c 6f 6e 67 29 0d 0a 2b 2f 7, u_long)..+/ 0f10: 0d 0a 0d 0a 65 6e 75 6d 20 3a 20 44 57 4f 52 44 ....enum : DWORD 0f20: 20 7b 0d 0a 09 46 49 4f 4e 42 49 4f 20 20 20 20 {...FIONBIO 0f30: 3d 20 30 78 38 30 30 34 36 36 37 45 2c 0d 0a 09 = 0x8004667E,... 0f40: 46 49 4f 4e 52 45 41 44 20 20 20 3d 20 30 78 34 FIONREAD = 0x4 0f50: 30 30 34 36 36 37 46 2c 0d 0a 09 46 49 4f 41 53 004667F,...FIOAS 0f60: 59 4e 43 20 20 20 3d 20 30 78 38 30 30 34 36 36 YNC = 0x800466 0f70: 37 44 2c 0d 0a 09 53 49 4f 43 53 48 49 57 41 54 7D,...SIOCSHIWAT 0f80: 20 3d 20 30 78 38 30 30 34 37 33 30 30 2c 0d 0a = 0x80047300,.. 0f90: 09 53 49 4f 43 47 48 49 57 41 54 20 3d 20 30 78 .SIOCGHIWAT = 0x 0fa0: 34 30 30 34 37 33 30 31 2c 0d 0a 09 53 49 4f 43 40047301,...SIOC 0fb0: 53 4c 4f 57 41 54 20 3d 20 30 78 38 30 30 34 37 SLOWAT = 0x80047 0fc0: 33 30 32 2c 0d 0a 09 53 49 4f 43 47 4c 4f 57 41 302,...SIOCGLOWA 0fd0: 54 20 3d 20 30 78 34 30 30 34 37 33 30 33 2c 0d T = 0x40047303,. 0fe0: 0a 09 53 49 4f 43 41 54 4d 41 52 4b 20 3d 20 30 ..SIOCATMARK = 0 0ff0: 78 34 30 30 34 37 33 30 37 0d 0a 7d 0d 0a 0d 0a x40047307..}.... 1000: 73 74 72 75 63 74 20 6e 65 74 65 6e 74 20 7b 0d struct netent {. 1010: 0a 09 63 68 61 72 2a 20 20 6e 5f 6e 61 6d 65 3b ..char* n_name; 1020: 0d 0a 09 63 68 61 72 2a 2a 20 6e 5f 61 6c 69 61 ...char** n_alia 1030: 73 65 73 3b 0d 0a 09 73 68 6f 72 74 20 20 6e 5f ses;...short n_ 1040: 61 64 64 72 74 79 70 65 3b 0d 0a 09 75 5f 6c 6f addrtype;...u_lo 1050: 6e 67 20 6e 5f 6e 65 74 3b 0d 0a 7d 0d 0a 0d 0a ng n_net;..}.... 1060: 73 74 72 75 63 74 20 53 45 52 56 45 4e 54 20 7b struct SERVENT { 1070: 0d 0a 09 63 68 61 72 2a 20 20 73 5f 6e 61 6d 65 ...char* s_name 1080: 3b 0d 0a 09 63 68 61 72 2a 2a 20 73 5f 61 6c 69 ;...char** s_ali 1090: 61 73 65 73 3b 0d 0a 09 73 68 6f 72 74 20 20 73 ases;...short s 10a0: 5f 70 6f 72 74 3b 0d 0a 09 63 68 61 72 2a 20 20 _port;...char* 10b0: 73 5f 70 72 6f 74 6f 3b 0d 0a 7d 0d 0a 61 6c 69 s_proto;..}..ali 10c0: 61 73 20 53 45 52 56 45 4e 54 2a 20 50 53 45 52 as SERVENT* PSER 10d0: 56 45 4e 54 2c 20 4c 50 53 45 52 56 45 4e 54 3b VENT, LPSERVENT; 10e0: 0d 0a 0d 0a 73 74 72 75 63 74 20 50 52 4f 54 4f ....struct PROTO 10f0: 45 4e 54 20 7b 0d 0a 09 63 68 61 72 2a 20 20 70 ENT {...char* p 1100: 5f 6e 61 6d 65 3b 0d 0a 09 63 68 61 72 2a 2a 20 _name;...char** 1110: 70 5f 61 6c 69 61 73 65 73 3b 0d 0a 09 73 68 6f p_aliases;...sho 1120: 72 74 20 20 70 5f 70 72 6f 74 6f 3b 0d 0a 7d 0d rt p_proto;..}. 1130: 0a 61 6c 69 61 73 20 50 52 4f 54 4f 45 4e 54 2a .alias PROTOENT* 1140: 20 50 50 52 4f 54 4f 45 4e 54 2c 20 4c 50 50 52 PPROTOENT, LPPR 1150: 4f 54 4f 45 4e 54 3b 0d 0a 0d 0a 65 6e 75 6d 20 OTOENT;....enum 1160: 3a 20 69 6e 74 20 7b 0d 0a 09 49 50 50 52 4f 54 : int {...IPPROT 1170: 4f 5f 49 50 20 20 20 3d 20 20 20 30 2c 0d 0a 09 O_IP = 0,... 1180: 49 50 50 52 4f 54 4f 5f 49 43 4d 50 20 3d 20 20 IPPROTO_ICMP = 1190: 20 31 2c 0d 0a 09 49 50 50 52 4f 54 4f 5f 49 47 1,...IPPROTO_IG 11a0: 4d 50 20 3d 20 20 20 32 2c 0d 0a 09 49 50 50 52 MP = 2,...IPPR 11b0: 4f 54 4f 5f 47 47 50 20 20 3d 20 20 20 33 2c 0d OTO_GGP = 3,. 11c0: 0a 09 49 50 50 52 4f 54 4f 5f 54 43 50 20 20 3d ..IPPROTO_TCP = 11d0: 20 20 20 36 2c 0d 0a 09 49 50 50 52 4f 54 4f 5f 6,...IPPROTO_ 11e0: 50 55 50 20 20 3d 20 20 31 32 2c 0d 0a 09 49 50 PUP = 12,...IP 11f0: 50 52 4f 54 4f 5f 55 44 50 20 20 3d 20 20 31 37 PROTO_UDP = 17 1200: 2c 0d 0a 09 49 50 50 52 4f 54 4f 5f 49 44 50 20 ,...IPPROTO_IDP 1210: 20 3d 20 20 32 32 2c 0d 0a 09 49 50 50 52 4f 54 = 22,...IPPROT 1220: 4f 5f 4e 44 20 20 20 3d 20 20 37 37 2c 0d 0a 09 O_ND = 77,... 1230: 49 50 50 52 4f 54 4f 5f 52 41 57 20 20 3d 20 32 IPPROTO_RAW = 2 1240: 35 35 2c 0d 0a 09 49 50 50 52 4f 54 4f 5f 4d 41 55,...IPPROTO_MA 1250: 58 20 20 3d 20 32 35 36 0d 0a 7d 0d 0a 0d 0a 2f X = 256..}..../ 1260: 2f 20 54 68 65 73 65 20 61 72 65 20 6e 6f 74 20 / These are not 1270: 64 6f 63 75 6d 65 6e 74 65 64 20 6f 6e 20 74 68 documented on th 1280: 65 20 4d 53 44 4e 20 73 69 74 65 0d 0a 65 6e 75 e MSDN site..enu 1290: 6d 20 7b 0d 0a 09 49 50 50 4f 52 54 5f 45 43 48 m {...IPPORT_ECH 12a0: 4f 20 20 20 20 20 20 20 20 3d 20 20 20 20 37 2c O = 7, 12b0: 0d 0a 09 49 50 50 4f 52 54 5f 44 49 53 43 41 52 ...IPPORT_DISCAR 12c0: 44 20 20 20 20 20 3d 20 20 20 20 39 2c 0d 0a 09 D = 9,... 12d0: 49 50 50 4f 52 54 5f 53 59 53 54 41 54 20 20 20 IPPORT_SYSTAT 12e0: 20 20 20 3d 20 20 20 31 31 2c 0d 0a 09 49 50 50 = 11,...IPP 12f0: 4f 52 54 5f 44 41 59 54 49 4d 45 20 20 20 20 20 ORT_DAYTIME 1300: 3d 20 20 20 31 33 2c 0d 0a 09 49 50 50 4f 52 54 = 13,...IPPORT 1310: 5f 4e 45 54 53 54 41 54 20 20 20 20 20 3d 20 20 _NETSTAT = 1320: 20 31 35 2c 0d 0a 09 49 50 50 4f 52 54 5f 46 54 15,...IPPORT_FT 1330: 50 20 20 20 20 20 20 20 20 20 3d 20 20 20 32 31 P = 21 1340: 2c 0d 0a 09 49 50 50 4f 52 54 5f 54 45 4c 4e 45 ,...IPPORT_TELNE 1350: 54 20 20 20 20 20 20 3d 20 20 20 32 33 2c 0d 0a T = 23,.. 1360: 09 49 50 50 4f 52 54 5f 53 4d 54 50 20 20 20 20 .IPPORT_SMTP 1370: 20 20 20 20 3d 20 20 20 32 35 2c 0d 0a 09 49 50 = 25,...IP 1380: 50 4f 52 54 5f 54 49 4d 45 53 45 52 56 45 52 20 PORT_TIMESERVER 1390: 20 3d 20 20 20 33 37 2c 0d 0a 09 49 50 50 4f 52 = 37,...IPPOR 13a0: 54 5f 4e 41 4d 45 53 45 52 56 45 52 20 20 3d 20 T_NAMESERVER = 13b0: 20 20 34 32 2c 0d 0a 09 49 50 50 4f 52 54 5f 57 42,...IPPORT_W 13c0: 48 4f 49 53 20 20 20 20 20 20 20 3d 20 20 20 34 HOIS = 4 13d0: 33 2c 0d 0a 09 49 50 50 4f 52 54 5f 4d 54 50 20 3,...IPPORT_MTP 13e0: 20 20 20 20 20 20 20 20 3d 20 20 20 35 37 2c 0d = 57,. 13f0: 0a 09 49 50 50 4f 52 54 5f 54 46 54 50 20 20 20 ..IPPORT_TFTP 1400: 20 20 20 20 20 3d 20 20 20 36 39 2c 0d 0a 09 49 = 69,...I 1410: 50 50 4f 52 54 5f 52 4a 45 20 20 20 20 20 20 20 PPORT_RJE 1420: 20 20 3d 20 20 20 37 37 2c 0d 0a 09 49 50 50 4f = 77,...IPPO 1430: 52 54 5f 46 49 4e 47 45 52 20 20 20 20 20 20 3d RT_FINGER = 1440: 20 20 20 37 39 2c 0d 0a 09 49 50 50 4f 52 54 5f 79,...IPPORT_ 1450: 54 54 59 4c 49 4e 4b 20 20 20 20 20 3d 20 20 20 TTYLINK = 1460: 38 37 2c 0d 0a 09 49 50 50 4f 52 54 5f 53 55 50 87,...IPPORT_SUP 1470: 44 55 50 20 20 20 20 20 20 3d 20 20 20 39 35 2c DUP = 95, 1480: 0d 0a 09 49 50 50 4f 52 54 5f 45 58 45 43 53 45 ...IPPORT_EXECSE 1490: 52 56 45 52 20 20 3d 20 20 35 31 32 2c 0d 0a 09 RVER = 512,... 14a0: 49 50 50 4f 52 54 5f 4c 4f 47 49 4e 53 45 52 56 IPPORT_LOGINSERV 14b0: 45 52 20 3d 20 20 35 31 33 2c 0d 0a 09 49 50 50 ER = 513,...IPP 14c0: 4f 52 54 5f 43 4d 44 53 45 52 56 45 52 20 20 20 ORT_CMDSERVER 14d0: 3d 20 20 35 31 34 2c 0d 0a 09 49 50 50 4f 52 54 = 514,...IPPORT 14e0: 5f 45 46 53 53 45 52 56 45 52 20 20 20 3d 20 20 _EFSSERVER = 14f0: 35 32 30 2c 0d 0a 09 49 50 50 4f 52 54 5f 42 49 520,...IPPORT_BI 1500: 46 46 55 44 50 20 20 20 20 20 3d 20 20 35 31 32 FFUDP = 512 1510: 2c 0d 0a 09 49 50 50 4f 52 54 5f 57 48 4f 53 45 ,...IPPORT_WHOSE 1520: 52 56 45 52 20 20 20 3d 20 20 35 31 33 2c 0d 0a RVER = 513,.. 1530: 09 49 50 50 4f 52 54 5f 52 4f 55 54 45 53 45 52 .IPPORT_ROUTESER 1540: 56 45 52 20 3d 20 20 35 32 30 2c 0d 0a 09 49 50 VER = 520,...IP 1550: 50 4f 52 54 5f 52 45 53 45 52 56 45 44 20 20 20 PORT_RESERVED 1560: 20 3d 20 31 30 32 34 0d 0a 7d 0d 0a 0d 0a 2f 2f = 1024..}....// 1570: 20 54 68 65 73 65 20 61 72 65 20 6e 6f 74 20 64 These are not d 1580: 6f 63 75 6d 65 6e 74 65 64 20 6f 6e 20 74 68 65 ocumented on the 1590: 20 4d 53 44 4e 20 73 69 74 65 0d 0a 65 6e 75 6d MSDN site..enum 15a0: 20 7b 0d 0a 09 49 4d 50 4c 49 4e 4b 5f 49 50 20 {...IMPLINK_IP 15b0: 20 20 20 20 20 20 20 3d 20 31 35 35 2c 0d 0a 09 = 155,... 15c0: 49 4d 50 4c 49 4e 4b 5f 4c 4f 57 45 58 50 45 52 IMPLINK_LOWEXPER 15d0: 20 20 3d 20 31 35 36 2c 0d 0a 09 49 4d 50 4c 49 = 156,...IMPLI 15e0: 4e 4b 5f 48 49 47 48 45 58 50 45 52 20 3d 20 31 NK_HIGHEXPER = 1 15f0: 35 38 0d 0a 7d 0d 0a 0d 0a 73 74 72 75 63 74 20 58..}....struct 1600: 49 4e 5f 41 44 44 52 20 7b 0d 0a 09 75 6e 69 6f IN_ADDR {...unio 1610: 6e 20 7b 0d 0a 09 09 73 74 72 75 63 74 20 7b 20 n {....struct { 1620: 75 5f 63 68 61 72 20 73 5f 6e 65 74 2c 20 73 5f u_char s_net, s_ 1630: 68 6f 73 74 2c 20 73 5f 6c 68 2c 20 73 5f 69 6d host, s_lh, s_im 1640: 70 6e 6f 3b 20 7d 0d 0a 09 09 73 74 72 75 63 74 pno; }....struct 1650: 20 7b 20 75 5f 73 68 6f 72 74 20 73 5f 77 31 2c { u_short s_w1, 1660: 20 73 5f 69 6d 70 3b 20 7d 0d 0a 09 09 75 5f 6c s_imp; }....u_l 1670: 6f 6e 67 20 73 5f 61 64 64 72 3b 0d 0a 09 7d 0d ong s_addr;...}. 1680: 0a 7d 0d 0a 61 6c 69 61 73 20 49 4e 5f 41 44 44 .}..alias IN_ADD 1690: 52 2a 20 50 49 4e 5f 41 44 44 52 2c 20 4c 50 49 R* PIN_ADDR, LPI 16a0: 4e 5f 41 44 44 52 3b 0d 0a 0d 0a 2f 2f 20 49 4e N_ADDR;....// IN 16b0: 5f 43 4c 41 53 53 78 20 61 72 65 20 6e 6f 74 20 _CLASSx are not 16c0: 75 73 65 64 20 61 6e 79 77 68 65 72 65 20 6f 72 used anywhere or 16d0: 20 64 6f 63 75 6d 65 6e 74 65 64 20 6f 6e 20 4d documented on M 16e0: 53 44 4e 2e 0d 0a 62 6f 6f 6c 20 49 4e 5f 43 4c SDN...bool IN_CL 16f0: 41 53 53 41 28 69 6e 74 20 69 29 20 7b 0d 0a 09 ASSA(int i) {... 1700: 72 65 74 75 72 6e 20 28 69 20 26 20 30 78 38 30 return (i & 0x80 1710: 30 30 30 30 30 30 29 20 3d 3d 20 30 3b 0d 0a 7d 000000) == 0;..} 1720: 0d 0a 0d 0a 63 6f 6e 73 74 20 49 4e 5f 43 4c 41 ....const IN_CLA 1730: 53 53 41 5f 4e 45 54 20 20 20 20 3d 20 30 78 66 SSA_NET = 0xf 1740: 66 30 30 30 30 30 30 3b 0d 0a 63 6f 6e 73 74 20 f000000;..const 1750: 49 4e 5f 43 4c 41 53 53 41 5f 4e 53 48 49 46 54 IN_CLASSA_NSHIFT 1760: 20 3d 20 20 32 34 3b 0d 0a 63 6f 6e 73 74 20 49 = 24;..const I 1770: 4e 5f 43 4c 41 53 53 41 5f 48 4f 53 54 20 20 20 N_CLASSA_HOST 1780: 3d 20 30 78 30 30 66 66 66 66 66 66 3b 0d 0a 63 = 0x00ffffff;..c 1790: 6f 6e 73 74 20 49 4e 5f 43 4c 41 53 53 41 5f 4d onst IN_CLASSA_M 17a0: 41 58 20 20 20 20 3d 20 31 32 38 3b 0d 0a 0d 0a AX = 128;.... 17b0: 62 6f 6f 6c 20 49 4e 5f 43 4c 41 53 53 42 28 69 bool IN_CLASSB(i 17c0: 6e 74 20 69 29 20 7b 0d 0a 09 72 65 74 75 72 6e nt i) {...return 17d0: 20 28 69 20 26 20 30 78 43 30 30 30 30 30 30 30 (i & 0xC0000000 17e0: 29 20 3d 3d 20 30 78 38 30 30 30 30 30 30 30 3b ) == 0x80000000; 17f0: 0d 0a 7d 0d 0a 0d 0a 63 6f 6e 73 74 20 49 4e 5f ..}....const IN_ 1800: 43 4c 41 53 53 42 5f 4e 45 54 20 20 20 20 3d 20 CLASSB_NET = 1810: 30 78 66 66 66 66 30 30 30 30 3b 0d 0a 63 6f 6e 0xffff0000;..con 1820: 73 74 20 49 4e 5f 43 4c 41 53 53 42 5f 4e 53 48 st IN_CLASSB_NSH 1830: 49 46 54 20 3d 20 31 36 3b 0d 0a 63 6f 6e 73 74 IFT = 16;..const 1840: 20 49 4e 5f 43 4c 41 53 53 42 5f 48 4f 53 54 20 IN_CLASSB_HOST 1850: 20 20 3d 20 30 78 30 30 30 30 66 66 66 66 3b 0d = 0x0000ffff;. 1860: 0a 63 6f 6e 73 74 20 49 4e 5f 43 4c 41 53 53 42 .const IN_CLASSB 1870: 5f 4d 41 58 20 20 20 20 3d 20 36 35 35 33 36 3b _MAX = 65536; 1880: 0d 0a 0d 0a 62 6f 6f 6c 20 49 4e 5f 43 4c 41 53 ....bool IN_CLAS 1890: 53 43 28 69 6e 74 20 69 29 20 7b 0d 0a 09 72 65 SC(int i) {...re 18a0: 74 75 72 6e 20 28 69 20 26 20 30 78 45 30 30 30 turn (i & 0xE000 18b0: 30 30 30 30 29 20 3d 3d 20 30 78 43 30 30 30 30 0000) == 0xC0000 18c0: 30 30 30 3b 0d 0a 7d 0d 0a 0d 0a 63 6f 6e 73 74 000;..}....const 18d0: 20 49 4e 5f 43 4c 41 53 53 43 5f 4e 45 54 20 20 IN_CLASSC_NET 18e0: 20 20 3d 20 30 78 66 66 66 66 66 66 30 30 3b 0d = 0xffffff00;. 18f0: 0a 63 6f 6e 73 74 20 49 4e 5f 43 4c 41 53 53 43 .const IN_CLASSC 1900: 5f 4e 53 48 49 46 54 20 3d 20 38 3b 0d 0a 63 6f _NSHIFT = 8;..co 1910: 6e 73 74 20 49 4e 5f 43 4c 41 53 53 43 5f 48 4f nst IN_CLASSC_HO 1920: 53 54 20 20 20 3d 20 30 78 30 30 30 30 30 30 66 ST = 0x000000f 1930: 66 3b 0d 0a 0d 0a 63 6f 6e 73 74 20 75 5f 6c 6f f;....const u_lo 1940: 6e 67 0d 0a 09 49 4e 41 44 44 52 5f 41 4e 59 20 ng...INADDR_ANY 1950: 20 20 20 20 20 20 3d 20 30 2c 0d 0a 09 49 4e 41 = 0,...INA 1960: 44 44 52 5f 4c 4f 4f 50 42 41 43 4b 20 20 3d 20 DDR_LOOPBACK = 1970: 30 78 37 46 30 30 30 30 30 31 2c 0d 0a 09 49 4e 0x7F000001,...IN 1980: 41 44 44 52 5f 42 52 4f 41 44 43 41 53 54 20 3d ADDR_BROADCAST = 1990: 20 30 78 46 46 46 46 46 46 46 46 2c 0d 0a 09 49 0xFFFFFFFF,...I 19a0: 4e 41 44 44 52 5f 4e 4f 4e 45 20 20 20 20 20 20 NADDR_NONE 19b0: 3d 20 30 78 46 46 46 46 46 46 46 46 3b 0d 0a 0d = 0xFFFFFFFF;... 19c0: 0a 73 74 72 75 63 74 20 53 4f 43 4b 41 44 44 52 .struct SOCKADDR 19d0: 5f 49 4e 20 7b 0d 0a 09 73 68 6f 72 74 20 20 20 _IN {...short 19e0: 73 69 6e 5f 66 61 6d 69 6c 79 3b 0d 0a 09 75 5f sin_family;...u_ 19f0: 73 68 6f 72 74 20 73 69 6e 5f 70 6f 72 74 3b 0d short sin_port;. 1a00: 0a 09 49 4e 5f 41 44 44 52 20 73 69 6e 5f 61 64 ..IN_ADDR sin_ad 1a10: 64 72 3b 0d 0a 09 63 68 61 72 5b 38 5d 20 73 69 dr;...char[8] si 1a20: 6e 5f 7a 65 72 6f 3b 0d 0a 7d 0d 0a 61 6c 69 61 n_zero;..}..alia 1a30: 73 20 53 4f 43 4b 41 44 44 52 5f 49 4e 2a 20 50 s SOCKADDR_IN* P 1a40: 53 4f 43 4b 41 44 44 52 5f 49 4e 2c 20 4c 50 53 SOCKADDR_IN, LPS 1a50: 4f 43 4b 41 44 44 52 5f 49 4e 3b 0d 0a 0d 0a 63 OCKADDR_IN;....c 1a60: 6f 6e 73 74 20 73 69 7a 65 5f 74 0d 0a 09 57 53 onst size_t...WS 1a70: 41 44 45 53 43 52 49 50 54 49 4f 4e 5f 4c 45 4e ADESCRIPTION_LEN 1a80: 20 3d 20 32 35 36 2c 0d 0a 09 57 53 41 53 59 53 = 256,...WSASYS 1a90: 5f 53 54 41 54 55 53 5f 4c 45 4e 20 20 3d 20 31 _STATUS_LEN = 1 1aa0: 32 38 3b 0d 0a 0d 0a 73 74 72 75 63 74 20 57 53 28;....struct WS 1ab0: 41 44 41 54 41 20 7b 0d 0a 09 57 4f 52 44 20 20 ADATA {...WORD 1ac0: 20 77 56 65 72 73 69 6f 6e 3b 0d 0a 09 57 4f 52 wVersion;...WOR 1ad0: 44 20 20 20 77 48 69 67 68 56 65 72 73 69 6f 6e D wHighVersion 1ae0: 3b 0d 0a 09 63 68 61 72 5b 57 53 41 44 45 53 43 ;...char[WSADESC 1af0: 52 49 50 54 49 4f 4e 5f 4c 45 4e 2b 31 5d 20 73 RIPTION_LEN+1] s 1b00: 7a 44 65 73 63 72 69 70 74 69 6f 6e 3b 0d 0a 09 zDescription;... 1b10: 63 68 61 72 5b 57 53 41 53 59 53 5f 53 54 41 54 char[WSASYS_STAT 1b20: 55 53 5f 4c 45 4e 2b 31 5d 20 20 73 7a 53 79 73 US_LEN+1] szSys 1b30: 74 65 6d 53 74 61 74 75 73 3b 0d 0a 09 75 73 68 temStatus;...ush 1b40: 6f 72 74 20 69 4d 61 78 53 6f 63 6b 65 74 73 3b ort iMaxSockets; 1b50: 0d 0a 09 75 73 68 6f 72 74 20 69 4d 61 78 55 64 ...ushort iMaxUd 1b60: 70 44 67 3b 0d 0a 09 63 68 61 72 2a 20 20 6c 70 pDg;...char* lp 1b70: 56 65 6e 64 6f 72 49 6e 66 6f 3b 0d 0a 7d 0d 0a VendorInfo;..}.. 1b80: 61 6c 69 61 73 20 57 53 41 44 41 54 41 2a 20 4c alias WSADATA* L 1b90: 50 57 53 41 44 41 54 41 3b 0d 0a 0d 0a 2f 2f 20 PWSADATA;....// 1ba0: 54 68 69 73 20 69 73 20 6e 6f 74 20 64 6f 63 75 This is not docu 1bb0: 6d 65 6e 74 65 64 20 6f 6e 20 74 68 65 20 4d 53 mented on the MS 1bc0: 44 4e 20 73 69 74 65 0d 0a 63 6f 6e 73 74 20 49 DN site..const I 1bd0: 50 5f 4f 50 54 49 4f 4e 53 20 3d 20 31 3b 0d 0a P_OPTIONS = 1;.. 1be0: 0d 0a 63 6f 6e 73 74 20 69 6e 74 0d 0a 09 53 4f ..const int...SO 1bf0: 5f 44 45 42 55 47 20 20 20 20 20 20 20 3d 20 20 _DEBUG = 1c00: 20 31 2c 0d 0a 09 53 4f 5f 41 43 43 45 50 54 43 1,...SO_ACCEPTC 1c10: 4f 4e 4e 20 20 3d 20 20 20 32 2c 0d 0a 09 53 4f ONN = 2,...SO 1c20: 5f 52 45 55 53 45 41 44 44 52 20 20 20 3d 20 20 _REUSEADDR = 1c30: 20 34 2c 0d 0a 09 53 4f 5f 4b 45 45 50 41 4c 49 4,...SO_KEEPALI 1c40: 56 45 20 20 20 3d 20 20 20 38 2c 0d 0a 09 53 4f VE = 8,...SO 1c50: 5f 44 4f 4e 54 52 4f 55 54 45 20 20 20 3d 20 20 _DONTROUTE = 1c60: 31 36 2c 0d 0a 09 53 4f 5f 42 52 4f 41 44 43 41 16,...SO_BROADCA 1c70: 53 54 20 20 20 3d 20 20 33 32 2c 0d 0a 09 53 4f ST = 32,...SO 1c80: 5f 55 53 45 4c 4f 4f 50 42 41 43 4b 20 3d 20 20 _USELOOPBACK = 1c90: 36 34 2c 0d 0a 09 53 4f 5f 4c 49 4e 47 45 52 20 64,...SO_LINGER 1ca0: 20 20 20 20 20 3d 20 31 32 38 2c 0d 0a 09 53 4f = 128,...SO 1cb0: 5f 4f 4f 42 49 4e 4c 49 4e 45 20 20 20 3d 20 32 _OOBINLINE = 2 1cc0: 35 36 2c 0d 0a 09 53 4f 5f 44 4f 4e 54 4c 49 4e 56,...SO_DONTLIN 1cd0: 47 45 52 20 20 3d 20 7e 53 4f 5f 4c 49 4e 47 45 GER = ~SO_LINGE 1ce0: 52 3b 0d 0a 0d 0a 65 6e 75 6d 20 3a 20 69 6e 74 R;....enum : int 1cf0: 20 7b 0d 0a 09 53 4f 5f 53 4e 44 42 55 46 20 3d {...SO_SNDBUF = 1d00: 20 30 78 31 30 30 31 2c 0d 0a 09 53 4f 5f 52 43 0x1001,...SO_RC 1d10: 56 42 55 46 2c 0d 0a 09 53 4f 5f 53 4e 44 4c 4f VBUF,...SO_SNDLO 1d20: 57 41 54 2c 0d 0a 09 53 4f 5f 52 43 56 4c 4f 57 WAT,...SO_RCVLOW 1d30: 41 54 2c 0d 0a 09 53 4f 5f 53 4e 44 54 49 4d 45 AT,...SO_SNDTIME 1d40: 4f 2c 0d 0a 09 53 4f 5f 52 43 56 54 49 4d 45 4f O,...SO_RCVTIMEO 1d50: 2c 0d 0a 09 53 4f 5f 45 52 52 4f 52 2c 0d 0a 09 ,...SO_ERROR,... 1d60: 53 4f 5f 54 59 50 45 20 2f 2f 20 3d 20 30 78 31 SO_TYPE // = 0x1 1d70: 30 30 38 0d 0a 7d 0d 0a 0d 0a 2f 2a 0d 0a 20 2a 008..}..../*.. * 1d80: 20 4e 6f 74 65 20 74 68 61 74 20 74 68 65 20 6e Note that the n 1d90: 65 78 74 20 35 20 49 50 20 64 65 66 69 6e 65 73 ext 5 IP defines 1da0: 20 61 72 65 20 73 70 65 63 69 66 69 63 20 74 6f are specific to 1db0: 20 57 69 6e 53 6f 63 6b 20 31 2e 31 20 28 77 73 WinSock 1.1 (ws 1dc0: 6f 63 6b 33 32 2e 64 6c 6c 29 2e 0d 0a 20 2a 20 ock32.dll)... * 1dd0: 54 68 65 79 20 77 69 6c 6c 20 63 61 75 73 65 20 They will cause 1de0: 65 72 72 6f 72 73 20 6f 72 20 75 6e 65 78 70 65 errors or unexpe 1df0: 63 74 65 64 20 72 65 73 75 6c 74 73 20 69 66 20 cted results if 1e00: 75 73 65 64 20 77 69 74 68 20 74 68 65 0d 0a 20 used with the.. 1e10: 2a 20 28 67 73 29 65 74 73 6f 63 6b 6f 70 74 73 * (gs)etsockopts 1e20: 20 65 78 70 6f 72 74 65 64 20 66 72 6f 6d 20 74 exported from t 1e30: 68 65 20 57 69 6e 53 6f 63 6b 20 32 20 6c 69 62 he WinSock 2 lib 1e40: 2c 20 77 73 32 5f 33 32 2e 64 6c 6c 2e 20 52 65 , ws2_32.dll. Re 1e50: 66 65 72 20 77 73 32 74 63 70 69 70 2e 68 2e 0d fer ws2tcpip.h.. 1e60: 0a 20 2a 2f 0d 0a 65 6e 75 6d 20 3a 20 69 6e 74 . */..enum : int 1e70: 20 7b 0d 0a 09 49 50 5f 4d 55 4c 54 49 43 41 53 {...IP_MULTICAS 1e80: 54 5f 49 46 20 3d 20 32 2c 0d 0a 09 49 50 5f 4d T_IF = 2,...IP_M 1e90: 55 4c 54 49 43 41 53 54 5f 54 54 4c 2c 0d 0a 09 ULTICAST_TTL,... 1ea0: 49 50 5f 4d 55 4c 54 49 43 41 53 54 5f 4c 4f 4f IP_MULTICAST_LOO 1eb0: 50 2c 0d 0a 09 49 50 5f 41 44 44 5f 4d 45 4d 42 P,...IP_ADD_MEMB 1ec0: 45 52 53 48 49 50 2c 0d 0a 09 49 50 5f 44 52 4f ERSHIP,...IP_DRO 1ed0: 50 5f 4d 45 4d 42 45 52 53 48 49 50 0d 0a 7d 0d P_MEMBERSHIP..}. 1ee0: 0a 0d 0a 2f 2f 20 54 68 65 73 65 20 61 72 65 20 ...// These are 1ef0: 6e 6f 74 20 64 6f 63 75 6d 65 6e 74 65 64 20 6f not documented o 1f00: 6e 20 74 68 65 20 4d 53 44 4e 20 73 69 74 65 0d n the MSDN site. 1f10: 0a 63 6f 6e 73 74 20 49 50 5f 44 45 46 41 55 4c .const IP_DEFAUL 1f20: 54 5f 4d 55 4c 54 49 43 41 53 54 5f 54 54 4c 20 T_MULTICAST_TTL 1f30: 20 3d 20 20 31 3b 0d 0a 63 6f 6e 73 74 20 49 50 = 1;..const IP 1f40: 5f 44 45 46 41 55 4c 54 5f 4d 55 4c 54 49 43 41 _DEFAULT_MULTICA 1f50: 53 54 5f 4c 4f 4f 50 20 3d 20 20 31 3b 0d 0a 63 ST_LOOP = 1;..c 1f60: 6f 6e 73 74 20 49 50 5f 4d 41 58 5f 4d 45 4d 42 onst IP_MAX_MEMB 1f70: 45 52 53 48 49 50 53 20 20 20 20 20 20 20 20 3d ERSHIPS = 1f80: 20 32 30 3b 0d 0a 0d 0a 73 74 72 75 63 74 20 69 20;....struct i 1f90: 70 5f 6d 72 65 71 20 7b 0d 0a 09 49 4e 5f 41 44 p_mreq {...IN_AD 1fa0: 44 52 20 69 6d 72 5f 6d 75 6c 74 69 61 64 64 72 DR imr_multiaddr 1fb0: 3b 0d 0a 09 49 4e 5f 41 44 44 52 20 69 6d 72 5f ;...IN_ADDR imr_ 1fc0: 69 6e 74 65 72 66 61 63 65 3b 0d 0a 7d 0d 0a 0d interface;..}... 1fd0: 0a 63 6f 6e 73 74 20 53 4f 43 4b 45 54 20 49 4e .const SOCKET IN 1fe0: 56 41 4c 49 44 5f 53 4f 43 4b 45 54 20 3d 20 75 VALID_SOCKET = u 1ff0: 69 6e 74 2e 6d 61 78 3b 0d 0a 63 6f 6e 73 74 20 int.max;..const 2000: 69 6e 74 20 53 4f 43 4b 45 54 5f 45 52 52 4f 52 int SOCKET_ERROR 2010: 20 3d 20 2d 31 3b 0d 0a 0d 0a 65 6e 75 6d 20 3a = -1;....enum : 2020: 20 69 6e 74 20 7b 0d 0a 09 53 4f 43 4b 5f 53 54 int {...SOCK_ST 2030: 52 45 41 4d 20 3d 20 31 2c 0d 0a 09 53 4f 43 4b REAM = 1,...SOCK 2040: 5f 44 47 52 41 4d 2c 0d 0a 09 53 4f 43 4b 5f 52 _DGRAM,...SOCK_R 2050: 41 57 2c 0d 0a 09 53 4f 43 4b 5f 52 44 4d 2c 0d AW,...SOCK_RDM,. 2060: 0a 09 53 4f 43 4b 5f 53 45 51 50 41 43 4b 45 54 ..SOCK_SEQPACKET 2070: 0d 0a 7d 0d 0a 0d 0a 63 6f 6e 73 74 20 69 6e 74 ..}....const int 2080: 20 54 43 50 5f 4e 4f 44 45 4c 41 59 20 3d 20 31 TCP_NODELAY = 1 2090: 3b 0d 0a 0d 0a 65 6e 75 6d 20 3a 20 69 6e 74 20 ;....enum : int 20a0: 7b 0d 0a 09 41 46 5f 55 4e 53 50 45 43 2c 0d 0a {...AF_UNSPEC,.. 20b0: 09 41 46 5f 55 4e 49 58 2c 0d 0a 09 41 46 5f 49 .AF_UNIX,...AF_I 20c0: 4e 45 54 2c 0d 0a 09 41 46 5f 49 4d 50 4c 49 4e NET,...AF_IMPLIN 20d0: 4b 2c 0d 0a 09 41 46 5f 50 55 50 2c 0d 0a 09 41 K,...AF_PUP,...A 20e0: 46 5f 43 48 41 4f 53 2c 0d 0a 09 41 46 5f 49 50 F_CHAOS,...AF_IP 20f0: 58 2c 20 20 2f 2f 20 3d 20 20 36 0d 0a 09 41 46 X, // = 6...AF 2100: 5f 4e 53 20 20 20 20 20 20 20 3d 20 20 36 2c 0d _NS = 6,. 2110: 0a 09 41 46 5f 49 53 4f 2c 0d 0a 09 41 46 5f 4f ..AF_ISO,...AF_O 2120: 53 49 20 20 20 20 20 20 3d 20 41 46 5f 49 53 4f SI = AF_ISO 2130: 2c 0d 0a 09 41 46 5f 45 43 4d 41 2c 0d 0a 09 41 ,...AF_ECMA,...A 2140: 46 5f 44 41 54 41 4b 49 54 2c 0d 0a 09 41 46 5f F_DATAKIT,...AF_ 2150: 43 43 49 54 54 2c 0d 0a 09 41 46 5f 53 4e 41 2c CCITT,...AF_SNA, 2160: 0d 0a 09 41 46 5f 44 45 43 6e 65 74 2c 0d 0a 09 ...AF_DECnet,... 2170: 41 46 5f 44 4c 49 2c 0d 0a 09 41 46 5f 4c 41 54 AF_DLI,...AF_LAT 2180: 2c 0d 0a 09 41 46 5f 48 59 4c 49 4e 4b 2c 0d 0a ,...AF_HYLINK,.. 2190: 09 41 46 5f 41 50 50 4c 45 54 41 4c 4b 2c 0d 0a .AF_APPLETALK,.. 21a0: 09 41 46 5f 4e 45 54 42 49 4f 53 2c 0d 0a 09 41 .AF_NETBIOS,...A 21b0: 46 5f 56 4f 49 43 45 56 49 45 57 2c 0d 0a 09 41 F_VOICEVIEW,...A 21c0: 46 5f 46 49 52 45 46 4f 58 2c 0d 0a 09 41 46 5f F_FIREFOX,...AF_ 21d0: 55 4e 4b 4e 4f 57 4e 31 2c 0d 0a 09 41 46 5f 42 UNKNOWN1,...AF_B 21e0: 41 4e 2c 0d 0a 09 41 46 5f 41 54 4d 2c 0d 0a 09 AN,...AF_ATM,... 21f0: 41 46 5f 49 4e 45 54 36 2c 0d 0a 09 41 46 5f 4d AF_INET6,...AF_M 2200: 41 58 20 20 2f 2f 20 3d 20 32 34 0d 0a 7d 0d 0a AX // = 24..}.. 2210: 0d 0a 73 74 72 75 63 74 20 53 4f 43 4b 41 44 44 ..struct SOCKADD 2220: 52 20 7b 0d 0a 09 75 5f 73 68 6f 72 74 20 20 73 R {...u_short s 2230: 61 5f 66 61 6d 69 6c 79 3b 0d 0a 09 63 68 61 72 a_family;...char 2240: 5b 31 34 5d 20 73 61 5f 64 61 74 61 3b 0d 0a 7d [14] sa_data;..} 2250: 0d 0a 61 6c 69 61 73 20 53 4f 43 4b 41 44 44 52 ..alias SOCKADDR 2260: 2a 20 50 53 4f 43 4b 41 44 44 52 2c 20 4c 50 53 * PSOCKADDR, LPS 2270: 4f 43 4b 41 44 44 52 3b 0d 0a 0d 0a 73 74 72 75 OCKADDR;....stru 2280: 63 74 20 73 6f 63 6b 70 72 6f 74 6f 20 7b 0d 0a ct sockproto {.. 2290: 09 75 5f 73 68 6f 72 74 20 73 70 5f 66 61 6d 69 .u_short sp_fami 22a0: 6c 79 3b 0d 0a 09 75 5f 73 68 6f 72 74 20 73 70 ly;...u_short sp 22b0: 5f 70 72 6f 74 6f 63 6f 6c 3b 0d 0a 7d 0d 0a 0d _protocol;..}... 22c0: 0a 65 6e 75 6d 20 3a 20 69 6e 74 20 7b 0d 0a 09 .enum : int {... 22d0: 50 46 5f 55 4e 53 50 45 43 20 20 20 20 3d 20 41 PF_UNSPEC = A 22e0: 46 5f 55 4e 53 50 45 43 2c 0d 0a 09 50 46 5f 55 F_UNSPEC,...PF_U 22f0: 4e 49 58 20 20 20 20 20 20 3d 20 41 46 5f 55 4e NIX = AF_UN 2300: 49 58 2c 0d 0a 09 50 46 5f 49 4e 45 54 20 20 20 IX,...PF_INET 2310: 20 20 20 3d 20 41 46 5f 49 4e 45 54 2c 0d 0a 09 = AF_INET,... 2320: 50 46 5f 49 4d 50 4c 49 4e 4b 20 20 20 3d 20 41 PF_IMPLINK = A 2330: 46 5f 49 4d 50 4c 49 4e 4b 2c 0d 0a 09 50 46 5f F_IMPLINK,...PF_ 2340: 50 55 50 20 20 20 20 20 20 20 3d 20 41 46 5f 50 PUP = AF_P 2350: 55 50 2c 0d 0a 09 50 46 5f 43 48 41 4f 53 20 20 UP,...PF_CHAOS 2360: 20 20 20 3d 20 41 46 5f 43 48 41 4f 53 2c 0d 0a = AF_CHAOS,.. 2370: 09 50 46 5f 4e 53 20 20 20 20 20 20 20 20 3d 20 .PF_NS = 2380: 41 46 5f 4e 53 2c 0d 0a 09 50 46 5f 49 50 58 20 AF_NS,...PF_IPX 2390: 20 20 20 20 20 20 3d 20 41 46 5f 49 50 58 2c 0d = AF_IPX,. 23a0: 0a 09 50 46 5f 49 53 4f 20 20 20 20 20 20 20 3d ..PF_ISO = 23b0: 20 41 46 5f 49 53 4f 2c 0d 0a 09 50 46 5f 4f 53 AF_ISO,...PF_OS 23c0: 49 20 20 20 20 20 20 20 3d 20 41 46 5f 4f 53 49 I = AF_OSI 23d0: 2c 0d 0a 09 50 46 5f 45 43 4d 41 20 20 20 20 20 ,...PF_ECMA 23e0: 20 3d 20 41 46 5f 45 43 4d 41 2c 0d 0a 09 50 46 = AF_ECMA,...PF 23f0: 5f 44 41 54 41 4b 49 54 20 20 20 3d 20 41 46 5f _DATAKIT = AF_ 2400: 44 41 54 41 4b 49 54 2c 0d 0a 09 50 46 5f 43 43 DATAKIT,...PF_CC 2410: 49 54 54 20 20 20 20 20 3d 20 41 46 5f 43 43 49 ITT = AF_CCI 2420: 54 54 2c 0d 0a 09 50 46 5f 53 4e 41 20 20 20 20 TT,...PF_SNA 2430: 20 20 20 3d 20 41 46 5f 53 4e 41 2c 0d 0a 09 50 = AF_SNA,...P 2440: 46 5f 44 45 43 6e 65 74 20 20 20 20 3d 20 41 46 F_DECnet = AF 2450: 5f 44 45 43 6e 65 74 2c 0d 0a 09 50 46 5f 44 4c _DECnet,...PF_DL 2460: 49 20 20 20 20 20 20 20 3d 20 41 46 5f 44 4c 49 I = AF_DLI 2470: 2c 0d 0a 09 50 46 5f 4c 41 54 20 20 20 20 20 20 ,...PF_LAT 2480: 20 3d 20 41 46 5f 4c 41 54 2c 0d 0a 09 50 46 5f = AF_LAT,...PF_ 2490: 48 59 4c 49 4e 4b 20 20 20 20 3d 20 41 46 5f 48 HYLINK = AF_H 24a0: 59 4c 49 4e 4b 2c 0d 0a 09 50 46 5f 41 50 50 4c YLINK,...PF_APPL 24b0: 45 54 41 4c 4b 20 3d 20 41 46 5f 41 50 50 4c 45 ETALK = AF_APPLE 24c0: 54 41 4c 4b 2c 0d 0a 09 50 46 5f 56 4f 49 43 45 TALK,...PF_VOICE 24d0: 56 49 45 57 20 3d 20 41 46 5f 56 4f 49 43 45 56 VIEW = AF_VOICEV 24e0: 49 45 57 2c 0d 0a 09 50 46 5f 46 49 52 45 46 4f IEW,...PF_FIREFO 24f0: 58 20 20 20 3d 20 41 46 5f 46 49 52 45 46 4f 58 X = AF_FIREFOX 2500: 2c 0d 0a 09 50 46 5f 55 4e 4b 4e 4f 57 4e 31 20 ,...PF_UNKNOWN1 2510: 20 3d 20 41 46 5f 55 4e 4b 4e 4f 57 4e 31 2c 0d = AF_UNKNOWN1,. 2520: 0a 09 50 46 5f 42 41 4e 20 20 20 20 20 20 20 3d ..PF_BAN = 2530: 20 41 46 5f 42 41 4e 2c 0d 0a 09 50 46 5f 41 54 AF_BAN,...PF_AT 2540: 4d 20 20 20 20 20 20 20 3d 20 41 46 5f 41 54 4d M = AF_ATM 2550: 2c 0d 0a 09 50 46 5f 49 4e 45 54 36 20 20 20 20 ,...PF_INET6 2560: 20 3d 20 41 46 5f 49 4e 45 54 36 2c 0d 0a 09 50 = AF_INET6,...P 2570: 46 5f 4d 41 58 20 20 20 20 20 20 20 3d 20 41 46 F_MAX = AF 2580: 5f 4d 41 58 0d 0a 7d 0d 0a 0d 0a 63 6f 6e 73 74 _MAX..}....const 2590: 20 69 6e 74 20 53 4f 4c 5f 53 4f 43 4b 45 54 20 int SOL_SOCKET 25a0: 3d 20 30 78 46 46 46 46 3b 0d 0a 0d 0a 63 6f 6e = 0xFFFF;....con 25b0: 73 74 20 69 6e 74 20 53 4f 4d 41 58 43 4f 4e 4e st int SOMAXCONN 25c0: 20 3d 20 35 3b 0d 0a 0d 0a 63 6f 6e 73 74 20 69 = 5;....const i 25d0: 6e 74 0d 0a 09 4d 53 47 5f 4f 4f 42 20 20 20 20 nt...MSG_OOB 25e0: 20 20 20 3d 20 31 2c 0d 0a 09 4d 53 47 5f 50 45 = 1,...MSG_PE 25f0: 45 4b 20 20 20 20 20 20 3d 20 32 2c 0d 0a 09 4d EK = 2,...M 2600: 53 47 5f 44 4f 4e 54 52 4f 55 54 45 20 3d 20 34 SG_DONTROUTE = 4 2610: 2c 0d 0a 09 4d 53 47 5f 4d 41 58 49 4f 56 4c 45 ,...MSG_MAXIOVLE 2620: 4e 20 3d 20 31 36 2c 0d 0a 09 4d 53 47 5f 50 41 N = 16,...MSG_PA 2630: 52 54 49 41 4c 20 20 20 3d 20 30 78 38 30 30 30 RTIAL = 0x8000 2640: 3b 0d 0a 0d 0a 63 6f 6e 73 74 20 73 69 7a 65 5f ;....const size_ 2650: 74 20 4d 41 58 47 45 54 48 4f 53 54 53 54 52 55 t MAXGETHOSTSTRU 2660: 43 54 20 3d 20 31 30 32 34 3b 0d 0a 0d 0a 63 6f CT = 1024;....co 2670: 6e 73 74 20 69 6e 74 0d 0a 09 46 44 5f 52 45 41 nst int...FD_REA 2680: 44 20 20 20 20 3d 20 20 31 2c 0d 0a 09 46 44 5f D = 1,...FD_ 2690: 57 52 49 54 45 20 20 20 3d 20 20 32 2c 0d 0a 09 WRITE = 2,... 26a0: 46 44 5f 4f 4f 42 20 20 20 20 20 3d 20 20 34 2c FD_OOB = 4, 26b0: 0d 0a 09 46 44 5f 41 43 43 45 50 54 20 20 3d 20 ...FD_ACCEPT = 26c0: 20 38 2c 0d 0a 09 46 44 5f 43 4f 4e 4e 45 43 54 8,...FD_CONNECT 26d0: 20 3d 20 31 36 2c 0d 0a 09 46 44 5f 43 4c 4f 53 = 16,...FD_CLOS 26e0: 45 20 20 20 3d 20 33 32 3b 0d 0a 0d 0a 65 6e 75 E = 32;....enu 26f0: 6d 20 3a 20 69 6e 74 20 7b 0d 0a 09 57 53 41 42 m : int {...WSAB 2700: 41 53 45 45 52 52 20 20 20 20 20 20 20 20 20 3d ASEERR = 2710: 20 31 30 30 30 30 2c 0d 0a 09 57 53 41 45 49 4e 10000,...WSAEIN 2720: 54 52 20 20 20 20 20 20 20 20 20 20 20 3d 20 31 TR = 1 2730: 30 30 30 34 2c 0d 0a 09 57 53 41 45 42 41 44 46 0004,...WSAEBADF 2740: 20 20 20 20 20 20 20 20 20 20 20 3d 20 31 30 30 = 100 2750: 30 39 2c 0d 0a 09 57 53 41 45 41 43 43 45 53 20 09,...WSAEACCES 2760: 20 20 20 20 20 20 20 20 20 3d 20 31 30 30 31 33 = 10013 2770: 2c 0d 0a 09 57 53 41 45 46 41 55 4c 54 20 20 20 ,...WSAEFAULT 2780: 20 20 20 20 20 20 20 3d 20 31 30 30 31 34 2c 0d = 10014,. 2790: 0a 09 57 53 41 45 49 4e 56 41 4c 20 20 20 20 20 ..WSAEINVAL 27a0: 20 20 20 20 20 3d 20 31 30 30 32 32 2c 0d 0a 09 = 10022,... 27b0: 57 53 41 45 4d 46 49 4c 45 20 20 20 20 20 20 20 WSAEMFILE 27c0: 20 20 20 3d 20 31 30 30 32 34 2c 0d 0a 09 57 53 = 10024,...WS 27d0: 41 45 57 4f 55 4c 44 42 4c 4f 43 4b 20 20 20 20 AEWOULDBLOCK 27e0: 20 3d 20 31 30 30 33 35 2c 0d 0a 09 57 53 41 45 = 10035,...WSAE 27f0: 49 4e 50 52 4f 47 52 45 53 53 20 20 20 20 20 3d INPROGRESS = 2800: 20 31 30 30 33 36 2c 0d 0a 09 57 53 41 45 41 4c 10036,...WSAEAL 2810: 52 45 41 44 59 20 20 20 20 20 20 20 20 3d 20 31 READY = 1 2820: 30 30 33 37 2c 0d 0a 09 57 53 41 45 4e 4f 54 53 0037,...WSAENOTS 2830: 4f 43 4b 20 20 20 20 20 20 20 20 3d 20 31 30 30 OCK = 100 2840: 33 38 2c 0d 0a 09 57 53 41 45 44 45 53 54 41 44 38,...WSAEDESTAD 2850: 44 52 52 45 51 20 20 20 20 3d 20 31 30 30 33 39 DRREQ = 10039 2860: 2c 0d 0a 09 57 53 41 45 4d 53 47 53 49 5a 45 20 ,...WSAEMSGSIZE 2870: 20 20 20 20 20 20 20 3d 20 31 30 30 34 30 2c 0d = 10040,. 2880: 0a 09 57 53 41 45 50 52 4f 54 4f 54 59 50 45 20 ..WSAEPROTOTYPE 2890: 20 20 20 20 20 3d 20 31 30 30 34 31 2c 0d 0a 09 = 10041,... 28a0: 57 53 41 45 4e 4f 50 52 4f 54 4f 4f 50 54 20 20 WSAENOPROTOOPT 28b0: 20 20 20 3d 20 31 30 30 34 32 2c 0d 0a 09 57 53 = 10042,...WS 28c0: 41 45 50 52 4f 54 4f 4e 4f 53 55 50 50 4f 52 54 AEPROTONOSUPPORT 28d0: 20 3d 20 31 30 30 34 33 2c 0d 0a 09 57 53 41 45 = 10043,...WSAE 28e0: 53 4f 43 4b 54 4e 4f 53 55 50 50 4f 52 54 20 3d SOCKTNOSUPPORT = 28f0: 20 31 30 30 34 34 2c 0d 0a 09 57 53 41 45 4f 50 10044,...WSAEOP 2900: 4e 4f 54 53 55 50 50 20 20 20 20 20 20 3d 20 31 NOTSUPP = 1 2910: 30 30 34 35 2c 0d 0a 09 57 53 41 45 50 46 4e 4f 0045,...WSAEPFNO 2920: 53 55 50 50 4f 52 54 20 20 20 20 3d 20 31 30 30 SUPPORT = 100 2930: 34 36 2c 0d 0a 09 57 53 41 45 41 46 4e 4f 53 55 46,...WSAEAFNOSU 2940: 50 50 4f 52 54 20 20 20 20 3d 20 31 30 30 34 37 PPORT = 10047 2950: 2c 0d 0a 09 57 53 41 45 41 44 44 52 49 4e 55 53 ,...WSAEADDRINUS 2960: 45 20 20 20 20 20 20 3d 20 31 30 30 34 38 2c 0d E = 10048,. 2970: 0a 09 57 53 41 45 41 44 44 52 4e 4f 54 41 56 41 ..WSAEADDRNOTAVA 2980: 49 4c 20 20 20 3d 20 31 30 30 34 39 2c 0d 0a 09 IL = 10049,... 2990: 57 53 41 45 4e 45 54 44 4f 57 4e 20 20 20 20 20 WSAENETDOWN 29a0: 20 20 20 3d 20 31 30 30 35 30 2c 0d 0a 09 57 53 = 10050,...WS 29b0: 41 45 4e 45 54 55 4e 52 45 41 43 48 20 20 20 20 AENETUNREACH 29c0: 20 3d 20 31 30 30 35 31 2c 0d 0a 09 57 53 41 45 = 10051,...WSAE 29d0: 4e 45 54 52 45 53 45 54 20 20 20 20 20 20 20 3d NETRESET = 29e0: 20 31 30 30 35 32 2c 0d 0a 09 57 53 41 45 43 4f 10052,...WSAECO 29f0: 4e 4e 41 42 4f 52 54 45 44 20 20 20 20 3d 20 31 NNABORTED = 1 2a00: 30 30 35 33 2c 0d 0a 09 57 53 41 45 43 4f 4e 4e 0053,...WSAECONN 2a10: 52 45 53 45 54 20 20 20 20 20 20 3d 20 31 30 30 RESET = 100 2a20: 35 34 2c 0d 0a 09 57 53 41 45 4e 4f 42 55 46 53 54,...WSAENOBUFS 2a30: 20 20 20 20 20 20 20 20 20 3d 20 31 30 30 35 35 = 10055 2a40: 2c 0d 0a 09 57 53 41 45 49 53 43 4f 4e 4e 20 20 ,...WSAEISCONN 2a50: 20 20 20 20 20 20 20 3d 20 31 30 30 35 36 2c 0d = 10056,. 2a60: 0a 09 57 53 41 45 4e 4f 54 43 4f 4e 4e 20 20 20 ..WSAENOTCONN 2a70: 20 20 20 20 20 3d 20 31 30 30 35 37 2c 0d 0a 09 = 10057,... 2a80: 57 53 41 45 53 48 55 54 44 4f 57 4e 20 20 20 20 WSAESHUTDOWN 2a90: 20 20 20 3d 20 31 30 30 35 38 2c 0d 0a 09 57 53 = 10058,...WS 2aa0: 41 45 54 4f 4f 4d 41 4e 59 52 45 46 53 20 20 20 AETOOMANYREFS 2ab0: 20 3d 20 31 30 30 35 39 2c 0d 0a 09 57 53 41 45 = 10059,...WSAE 2ac0: 54 49 4d 45 44 4f 55 54 20 20 20 20 20 20 20 3d TIMEDOUT = 2ad0: 20 31 30 30 36 30 2c 0d 0a 09 57 53 41 45 43 4f 10060,...WSAECO 2ae0: 4e 4e 52 45 46 55 53 45 44 20 20 20 20 3d 20 31 NNREFUSED = 1 2af0: 30 30 36 31 2c 0d 0a 09 57 53 41 45 4c 4f 4f 50 0061,...WSAELOOP 2b00: 20 20 20 20 20 20 20 20 20 20 20 3d 20 31 30 30 = 100 2b10: 36 32 2c 0d 0a 09 57 53 41 45 4e 41 4d 45 54 4f 62,...WSAENAMETO 2b20: 4f 4c 4f 4e 47 20 20 20 20 3d 20 31 30 30 36 33 OLONG = 10063 2b30: 2c 0d 0a 09 57 53 41 45 48 4f 53 54 44 4f 57 4e ,...WSAEHOSTDOWN 2b40: 20 20 20 20 20 20 20 3d 20 31 30 30 36 34 2c 0d = 10064,. 2b50: 0a 09 57 53 41 45 48 4f 53 54 55 4e 52 45 41 43 ..WSAEHOSTUNREAC 2b60: 48 20 20 20 20 3d 20 31 30 30 36 35 2c 0d 0a 09 H = 10065,... 2b70: 57 53 41 45 4e 4f 54 45 4d 50 54 59 20 20 20 20 WSAENOTEMPTY 2b80: 20 20 20 3d 20 31 30 30 36 36 2c 0d 0a 09 57 53 = 10066,...WS 2b90: 41 45 50 52 4f 43 4c 49 4d 20 20 20 20 20 20 20 AEPROCLIM 2ba0: 20 3d 20 31 30 30 36 37 2c 0d 0a 09 57 53 41 45 = 10067,...WSAE 2bb0: 55 53 45 52 53 20 20 20 20 20 20 20 20 20 20 3d USERS = 2bc0: 20 31 30 30 36 38 2c 0d 0a 09 57 53 41 45 44 51 10068,...WSAEDQ 2bd0: 55 4f 54 20 20 20 20 20 20 20 20 20 20 3d 20 31 UOT = 1 2be0: 30 30 36 39 2c 0d 0a 09 57 53 41 45 53 54 41 4c 0069,...WSAESTAL 2bf0: 45 20 20 20 20 20 20 20 20 20 20 3d 20 31 30 30 E = 100 2c00: 37 30 2c 0d 0a 09 57 53 41 45 52 45 4d 4f 54 45 70,...WSAEREMOTE 2c10: 20 20 20 20 20 20 20 20 20 3d 20 31 30 30 37 31 = 10071 2c20: 2c 0d 0a 09 57 53 41 45 44 49 53 43 4f 4e 20 20 ,...WSAEDISCON 2c30: 20 20 20 20 20 20 20 3d 20 31 30 31 30 31 2c 0d = 10101,. 2c40: 0a 09 57 53 41 53 59 53 4e 4f 54 52 45 41 44 59 ..WSASYSNOTREADY 2c50: 20 20 20 20 20 3d 20 31 30 30 39 31 2c 0d 0a 09 = 10091,... 2c60: 57 53 41 56 45 52 4e 4f 54 53 55 50 50 4f 52 54 WSAVERNOTSUPPORT 2c70: 45 44 20 3d 20 31 30 30 39 32 2c 0d 0a 09 57 53 ED = 10092,...WS 2c80: 41 4e 4f 54 49 4e 49 54 49 41 4c 49 53 45 44 20 ANOTINITIALISED 2c90: 20 3d 20 31 30 30 39 33 2c 0d 0a 09 57 53 41 48 = 10093,...WSAH 2ca0: 4f 53 54 5f 4e 4f 54 5f 46 4f 55 4e 44 20 20 3d OST_NOT_FOUND = 2cb0: 20 31 31 30 30 31 2c 0d 0a 09 57 53 41 54 52 59 11001,...WSATRY 2cc0: 5f 41 47 41 49 4e 20 20 20 20 20 20 20 3d 20 31 _AGAIN = 1 2cd0: 31 30 30 32 2c 0d 0a 09 57 53 41 4e 4f 5f 52 45 1002,...WSANO_RE 2ce0: 43 4f 56 45 52 59 20 20 20 20 20 3d 20 31 31 30 COVERY = 110 2cf0: 30 33 2c 0d 0a 09 57 53 41 4e 4f 5f 44 41 54 41 03,...WSANO_DATA 2d00: 20 20 20 20 20 20 20 20 20 3d 20 31 31 30 30 34 = 11004 2d10: 2c 0d 0a 09 57 53 41 4e 4f 5f 41 44 44 52 45 53 ,...WSANO_ADDRES 2d20: 53 20 20 20 20 20 20 3d 20 57 53 41 4e 4f 5f 44 S = WSANO_D 2d30: 41 54 41 0d 0a 7d 0d 0a 0d 0a 61 6c 69 61 73 20 ATA..}....alias 2d40: 57 53 41 47 65 74 4c 61 73 74 45 72 72 6f 72 20 WSAGetLastError 2d50: 68 5f 65 72 72 6e 6f 3b 0d 0a 0d 0a 65 6e 75 6d h_errno;....enum 2d60: 20 3a 20 69 6e 74 20 7b 0d 0a 09 48 4f 53 54 5f : int {...HOST_ 2d70: 4e 4f 54 5f 46 4f 55 4e 44 20 3d 20 57 53 41 48 NOT_FOUND = WSAH 2d80: 4f 53 54 5f 4e 4f 54 5f 46 4f 55 4e 44 2c 0d 0a OST_NOT_FOUND,.. 2d90: 09 54 52 59 5f 41 47 41 49 4e 20 20 20 20 20 20 .TRY_AGAIN 2da0: 3d 20 57 53 41 54 52 59 5f 41 47 41 49 4e 2c 0d = WSATRY_AGAIN,. 2db0: 0a 09 4e 4f 5f 52 45 43 4f 56 45 52 59 20 20 20 ..NO_RECOVERY 2dc0: 20 3d 20 57 53 41 4e 4f 5f 52 45 43 4f 56 45 52 = WSANO_RECOVER 2dd0: 59 2c 0d 0a 09 4e 4f 5f 44 41 54 41 20 20 20 20 Y,...NO_DATA 2de0: 20 20 20 20 3d 20 57 53 41 4e 4f 5f 44 41 54 41 = WSANO_DATA 2df0: 2c 0d 0a 09 4e 4f 5f 41 44 44 52 45 53 53 20 20 ,...NO_ADDRESS 2e00: 20 20 20 3d 20 57 53 41 4e 4f 5f 41 44 44 52 45 = WSANO_ADDRE 2e10: 53 53 0d 0a 7d 0d 0a 0d 0a 65 78 74 65 72 6e 20 SS..}....extern 2e20: 28 50 61 73 63 61 6c 29 20 7b 0d 0a 09 53 4f 43 (Pascal) {...SOC 2e30: 4b 45 54 20 61 63 63 65 70 74 28 53 4f 43 4b 45 KET accept(SOCKE 2e40: 54 2c 20 53 4f 43 4b 41 44 44 52 2a 2c 20 69 6e T, SOCKADDR*, in 2e50: 74 2a 29 3b 0d 0a 09 69 6e 74 20 62 69 6e 64 28 t*);...int bind( 2e60: 53 4f 43 4b 45 54 2c 20 63 6f 6e 73 74 28 53 4f SOCKET, const(SO 2e70: 43 4b 41 44 44 52 29 2a 2c 20 69 6e 74 29 3b 0d CKADDR)*, int);. 2e80: 0a 09 69 6e 74 20 63 6c 6f 73 65 73 6f 63 6b 65 ..int closesocke 2e90: 74 28 53 4f 43 4b 45 54 29 3b 0d 0a 09 69 6e 74 t(SOCKET);...int 2ea0: 20 63 6f 6e 6e 65 63 74 28 53 4f 43 4b 45 54 2c connect(SOCKET, 2eb0: 20 63 6f 6e 73 74 28 53 4f 43 4b 41 44 44 52 29 const(SOCKADDR) 2ec0: 2a 2c 20 69 6e 74 29 3b 0d 0a 09 69 6e 74 20 69 *, int);...int i 2ed0: 6f 63 74 6c 73 6f 63 6b 65 74 28 53 4f 43 4b 45 octlsocket(SOCKE 2ee0: 54 2c 20 69 6e 74 2c 20 75 5f 6c 6f 6e 67 2a 29 T, int, u_long*) 2ef0: 3b 0d 0a 09 69 6e 74 20 67 65 74 70 65 65 72 6e ;...int getpeern 2f00: 61 6d 65 28 53 4f 43 4b 45 54 2c 20 53 4f 43 4b ame(SOCKET, SOCK 2f10: 41 44 44 52 2a 2c 20 69 6e 74 2a 29 3b 0d 0a 09 ADDR*, int*);... 2f20: 69 6e 74 20 67 65 74 73 6f 63 6b 6e 61 6d 65 28 int getsockname( 2f30: 53 4f 43 4b 45 54 2c 20 53 4f 43 4b 41 44 44 52 SOCKET, SOCKADDR 2f40: 2a 2c 20 69 6e 74 2a 29 3b 0d 0a 09 69 6e 74 20 *, int*);...int 2f50: 67 65 74 73 6f 63 6b 6f 70 74 28 53 4f 43 4b 45 getsockopt(SOCKE 2f60: 54 2c 20 69 6e 74 2c 20 69 6e 74 2c 20 63 68 61 T, int, int, cha 2f70: 72 2a 2c 20 69 6e 74 2a 29 3b 0d 0a 09 75 69 6e r*, int*);...uin 2f80: 74 20 69 6e 65 74 5f 61 64 64 72 28 63 6f 6e 73 t inet_addr(cons 2f90: 74 28 63 68 61 72 29 2a 29 3b 0d 0a 09 69 6e 74 t(char)*);...int 2fa0: 20 6c 69 73 74 65 6e 28 53 4f 43 4b 45 54 2c 20 listen(SOCKET, 2fb0: 69 6e 74 29 3b 0d 0a 09 69 6e 74 20 72 65 63 76 int);...int recv 2fc0: 28 53 4f 43 4b 45 54 2c 20 63 68 61 72 2a 2c 20 (SOCKET, char*, 2fd0: 69 6e 74 2c 20 69 6e 74 29 3b 0d 0a 09 69 6e 74 int, int);...int 2fe0: 20 72 65 63 76 66 72 6f 6d 28 53 4f 43 4b 45 54 recvfrom(SOCKET 2ff0: 2c 20 63 68 61 72 2a 2c 20 69 6e 74 2c 20 69 6e , char*, int, in 3000: 74 2c 20 53 4f 43 4b 41 44 44 52 2a 2c 20 69 6e t, SOCKADDR*, in 3010: 74 2a 29 3b 0d 0a 09 69 6e 74 20 73 65 6e 64 28 t*);...int send( 3020: 53 4f 43 4b 45 54 2c 20 63 6f 6e 73 74 28 63 68 SOCKET, const(ch 3030: 61 72 29 2a 2c 20 69 6e 74 2c 20 69 6e 74 29 3b ar)*, int, int); 3040: 0d 0a 09 69 6e 74 20 73 65 6e 64 74 6f 28 53 4f ...int sendto(SO 3050: 43 4b 45 54 2c 20 63 6f 6e 73 74 28 63 68 61 72 CKET, const(char 3060: 29 2a 2c 20 69 6e 74 2c 20 69 6e 74 2c 20 63 6f )*, int, int, co 3070: 6e 73 74 28 53 4f 43 4b 41 44 44 52 29 2a 2c 20 nst(SOCKADDR)*, 3080: 69 6e 74 29 3b 0d 0a 09 69 6e 74 20 73 65 74 73 int);...int sets 3090: 6f 63 6b 6f 70 74 28 53 4f 43 4b 45 54 2c 20 69 ockopt(SOCKET, i 30a0: 6e 74 2c 20 69 6e 74 2c 20 63 6f 6e 73 74 28 63 nt, int, const(c 30b0: 68 61 72 29 2a 2c 20 69 6e 74 29 3b 0d 0a 09 69 har)*, int);...i 30c0: 6e 74 20 73 68 75 74 64 6f 77 6e 28 53 4f 43 4b nt shutdown(SOCK 30d0: 45 54 2c 20 69 6e 74 29 3b 0d 0a 09 53 4f 43 4b ET, int);...SOCK 30e0: 45 54 20 73 6f 63 6b 65 74 28 69 6e 74 2c 20 69 ET socket(int, i 30f0: 6e 74 2c 20 69 6e 74 29 3b 0d 0a 09 69 6e 74 20 nt, int);...int 3100: 57 53 41 53 74 61 72 74 75 70 28 57 4f 52 44 2c WSAStartup(WORD, 3110: 20 4c 50 57 53 41 44 41 54 41 29 3b 0d 0a 09 69 LPWSADATA);...i 3120: 6e 74 20 57 53 41 43 6c 65 61 6e 75 70 28 29 3b nt WSACleanup(); 3130: 0d 0a 09 76 6f 69 64 20 57 53 41 53 65 74 4c 61 ...void WSASetLa 3140: 73 74 45 72 72 6f 72 28 69 6e 74 29 3b 0d 0a 09 stError(int);... 3150: 69 6e 74 20 57 53 41 47 65 74 4c 61 73 74 45 72 int WSAGetLastEr 3160: 72 6f 72 28 29 3b 0d 0a 09 42 4f 4f 4c 20 57 53 ror();...BOOL WS 3170: 41 49 73 42 6c 6f 63 6b 69 6e 67 28 29 3b 0d 0a AIsBlocking();.. 3180: 09 69 6e 74 20 57 53 41 55 6e 68 6f 6f 6b 42 6c .int WSAUnhookBl 3190: 6f 63 6b 69 6e 67 48 6f 6f 6b 28 29 3b 0d 0a 09 ockingHook();... 31a0: 46 41 52 50 52 4f 43 20 57 53 41 53 65 74 42 6c FARPROC WSASetBl 31b0: 6f 63 6b 69 6e 67 48 6f 6f 6b 28 46 41 52 50 52 ockingHook(FARPR 31c0: 4f 43 29 3b 0d 0a 09 69 6e 74 20 57 53 41 43 61 OC);...int WSACa 31d0: 6e 63 65 6c 42 6c 6f 63 6b 69 6e 67 43 61 6c 6c ncelBlockingCall 31e0: 28 29 3b 0d 0a 09 48 41 4e 44 4c 45 20 57 53 41 ();...HANDLE WSA 31f0: 41 73 79 6e 63 47 65 74 53 65 72 76 42 79 4e 61 AsyncGetServByNa 3200: 6d 65 28 48 57 4e 44 2c 20 75 5f 69 6e 74 2c 20 me(HWND, u_int, 3210: 63 6f 6e 73 74 28 63 68 61 72 29 2a 2c 20 63 6f const(char)*, co 3220: 6e 73 74 28 63 68 61 72 29 2a 2c 20 63 68 61 72 nst(char)*, char 3230: 2a 2c 20 69 6e 74 29 3b 0d 0a 09 48 41 4e 44 4c *, int);...HANDL 3240: 45 20 57 53 41 41 73 79 6e 63 47 65 74 53 65 72 E WSAAsyncGetSer 3250: 76 42 79 50 6f 72 74 28 48 57 4e 44 2c 20 75 5f vByPort(HWND, u_ 3260: 69 6e 74 2c 20 69 6e 74 2c 20 63 6f 6e 73 74 28 int, int, const( 3270: 63 68 61 72 29 2a 2c 20 63 68 61 72 2a 2c 20 69 char)*, char*, i 3280: 6e 74 29 3b 0d 0a 09 48 41 4e 44 4c 45 20 57 53 nt);...HANDLE WS 3290: 41 41 73 79 6e 63 47 65 74 50 72 6f 74 6f 42 79 AAsyncGetProtoBy 32a0: 4e 61 6d 65 28 48 57 4e 44 2c 20 75 5f 69 6e 74 Name(HWND, u_int 32b0: 2c 20 63 6f 6e 73 74 28 63 68 61 72 29 2a 2c 20 , const(char)*, 32c0: 63 68 61 72 2a 2c 20 69 6e 74 29 3b 0d 0a 09 48 char*, int);...H 32d0: 41 4e 44 4c 45 20 57 53 41 41 73 79 6e 63 47 65 ANDLE WSAAsyncGe 32e0: 74 50 72 6f 74 6f 42 79 4e 75 6d 62 65 72 28 48 tProtoByNumber(H 32f0: 57 4e 44 2c 20 75 5f 69 6e 74 2c 20 69 6e 74 2c WND, u_int, int, 3300: 20 63 68 61 72 2a 2c 20 69 6e 74 29 3b 0d 0a 09 char*, int);... 3310: 48 41 4e 44 4c 45 20 57 53 41 41 73 79 6e 63 47 HANDLE WSAAsyncG 3320: 65 74 48 6f 73 74 42 79 4e 61 6d 65 28 48 57 4e etHostByName(HWN 3330: 44 2c 20 75 5f 69 6e 74 2c 20 63 6f 6e 73 74 28 D, u_int, const( 3340: 63 68 61 72 29 2a 2c 20 63 68 61 72 2a 2c 20 69 char)*, char*, i 3350: 6e 74 29 3b 0d 0a 09 48 41 4e 44 4c 45 20 57 53 nt);...HANDLE WS 3360: 41 41 73 79 6e 63 47 65 74 48 6f 73 74 42 79 41 AAsyncGetHostByA 3370: 64 64 72 28 48 57 4e 44 2c 20 75 5f 69 6e 74 2c ddr(HWND, u_int, 3380: 20 63 6f 6e 73 74 28 63 68 61 72 29 2a 2c 20 69 const(char)*, i 3390: 6e 74 2c 20 69 6e 74 2c 20 63 68 61 72 2a 2c 20 nt, int, char*, 33a0: 69 6e 74 29 3b 0d 0a 09 69 6e 74 20 57 53 41 43 int);...int WSAC 33b0: 61 6e 63 65 6c 41 73 79 6e 63 52 65 71 75 65 73 ancelAsyncReques 33c0: 74 28 48 41 4e 44 4c 45 29 3b 0d 0a 09 69 6e 74 t(HANDLE);...int 33d0: 20 57 53 41 41 73 79 6e 63 53 65 6c 65 63 74 28 WSAAsyncSelect( 33e0: 53 4f 43 4b 45 54 2c 20 48 57 4e 44 2c 20 75 5f SOCKET, HWND, u_ 33f0: 69 6e 74 2c 20 69 6e 74 29 3b 0d 0a 09 75 5f 6c int, int);...u_l 3400: 6f 6e 67 20 68 74 6f 6e 6c 28 75 5f 6c 6f 6e 67 ong htonl(u_long 3410: 29 3b 0d 0a 09 75 5f 6c 6f 6e 67 20 6e 74 6f 68 );...u_long ntoh 3420: 6c 28 75 5f 6c 6f 6e 67 29 3b 0d 0a 09 75 5f 73 l(u_long);...u_s 3430: 68 6f 72 74 20 68 74 6f 6e 73 28 75 5f 73 68 6f hort htons(u_sho 3440: 72 74 29 3b 0d 0a 09 75 5f 73 68 6f 72 74 20 6e rt);...u_short n 3450: 74 6f 68 73 28 75 5f 73 68 6f 72 74 29 3b 0d 0a tohs(u_short);.. 3460: 09 69 6e 74 20 73 65 6c 65 63 74 28 69 6e 74 20 .int select(int 3470: 6e 66 64 73 2c 20 46 44 5f 53 45 54 2a 2c 20 46 nfds, FD_SET*, F 3480: 44 5f 53 45 54 2a 2c 20 46 44 5f 53 45 54 2a 2c D_SET*, FD_SET*, 3490: 20 63 6f 6e 73 74 28 54 49 4d 45 56 41 4c 29 2a const(TIMEVAL)* 34a0: 29 3b 0d 0a 09 69 6e 74 20 67 65 74 68 6f 73 74 );...int gethost 34b0: 6e 61 6d 65 28 63 68 61 72 2a 2c 20 69 6e 74 29 name(char*, int) 34c0: 3b 0d 0a 7d 0d 0a 0d 0a 65 78 74 65 72 6e 20 28 ;..}....extern ( 34d0: 57 69 6e 64 6f 77 73 29 20 7b 0d 0a 09 63 68 61 Windows) {...cha 34e0: 72 2a 20 69 6e 65 74 5f 6e 74 6f 61 28 49 4e 5f r* inet_ntoa(IN_ 34f0: 41 44 44 52 29 3b 0d 0a 09 48 4f 53 54 45 4e 54 ADDR);...HOSTENT 3500: 2a 20 67 65 74 68 6f 73 74 62 79 61 64 64 72 28 * gethostbyaddr( 3510: 63 6f 6e 73 74 28 63 68 61 72 29 2a 2c 20 69 6e const(char)*, in 3520: 74 2c 20 69 6e 74 29 3b 0d 0a 09 48 4f 53 54 45 t, int);...HOSTE 3530: 4e 54 2a 20 67 65 74 68 6f 73 74 62 79 6e 61 6d NT* gethostbynam 3540: 65 28 63 6f 6e 73 74 28 63 68 61 72 29 2a 29 3b e(const(char)*); 3550: 0d 0a 09 53 45 52 56 45 4e 54 2a 20 67 65 74 73 ...SERVENT* gets 3560: 65 72 76 62 79 70 6f 72 74 28 69 6e 74 2c 20 63 ervbyport(int, c 3570: 6f 6e 73 74 28 63 68 61 72 29 2a 29 3b 0d 0a 09 onst(char)*);... 3580: 53 45 52 56 45 4e 54 2a 20 67 65 74 73 65 72 76 SERVENT* getserv 3590: 62 79 6e 61 6d 65 28 63 6f 6e 73 74 28 63 68 61 byname(const(cha 35a0: 72 29 2a 2c 20 63 6f 6e 73 74 28 63 68 61 72 29 r)*, const(char) 35b0: 2a 29 3b 0d 0a 09 50 52 4f 54 4f 45 4e 54 2a 20 *);...PROTOENT* 35c0: 67 65 74 70 72 6f 74 6f 62 79 6e 75 6d 62 65 72 getprotobynumber 35d0: 28 69 6e 74 29 3b 0d 0a 09 50 52 4f 54 4f 45 4e (int);...PROTOEN 35e0: 54 2a 20 67 65 74 70 72 6f 74 6f 62 79 6e 61 6d T* getprotobynam 35f0: 65 28 63 6f 6e 73 74 28 63 68 61 72 29 2a 29 3b e(const(char)*); 3600: 0d 0a 7d 0d 0a 0d 0a 61 6c 69 61 73 20 4d 41 4b ..}....alias MAK 3610: 45 4c 4f 4e 47 20 57 53 41 4d 41 4b 45 41 53 59 ELONG WSAMAKEASY 3620: 4e 43 52 45 50 4c 59 2c 20 57 53 41 4d 41 4b 45 NCREPLY, WSAMAKE 3630: 53 45 4c 45 43 54 52 45 50 4c 59 3b 0d 0a 61 6c SELECTREPLY;..al 3640: 69 61 73 20 4c 4f 57 4f 52 44 20 57 53 41 47 45 ias LOWORD WSAGE 3650: 54 41 53 59 4e 43 42 55 46 4c 45 4e 2c 20 57 53 TASYNCBUFLEN, WS 3660: 41 47 45 54 53 45 4c 45 43 54 45 56 45 4e 54 3b AGETSELECTEVENT; 3670: 0d 0a 61 6c 69 61 73 20 48 49 57 4f 52 44 20 57 ..alias HIWORD W 3680: 53 41 47 45 54 41 53 59 4e 43 45 52 52 4f 52 2c SAGETASYNCERROR, 3690: 20 57 53 41 47 45 54 53 45 4c 45 43 54 45 52 52 WSAGETSELECTERR 36a0: 4f 52 3b 0d 0a 0d 0a 0d 0a 2f 2a 0d 0a 20 2a 20 OR;....../*.. * 36b0: 52 65 63 65 6e 74 20 4d 53 44 4e 20 64 6f 63 73 Recent MSDN docs 36c0: 20 69 6e 64 69 63 61 74 65 20 74 68 61 74 20 74 indicate that t 36d0: 68 65 20 4d 53 2d 73 70 65 63 69 66 69 63 20 65 he MS-specific e 36e0: 78 74 65 6e 73 69 6f 6e 73 20 65 78 70 6f 72 74 xtensions export 36f0: 65 64 20 66 72 6f 6d 0d 0a 20 2a 20 6d 73 77 73 ed from.. * msws 3700: 6f 63 6b 2e 64 6c 6c 20 28 41 63 63 65 70 74 45 ock.dll (AcceptE 3710: 78 2c 20 54 72 61 6e 73 6d 69 74 46 69 6c 65 2e x, TransmitFile. 3720: 20 57 53 41 52 65 63 45 78 20 61 6e 64 20 47 65 WSARecEx and Ge 3730: 74 41 63 63 65 70 74 45 78 53 6f 63 6b 61 64 64 tAcceptExSockadd 3740: 72 73 29 20 61 72 65 0d 0a 20 2a 20 64 65 63 6c rs) are.. * decl 3750: 61 72 65 64 20 69 6e 20 6d 73 77 73 6f 63 6b 2e ared in mswsock. 3760: 68 2e 20 54 68 65 73 65 20 65 78 74 65 6e 73 69 h. These extensi 3770: 6f 6e 73 20 61 72 65 20 6e 6f 74 20 73 75 70 70 ons are not supp 3780: 6f 72 74 65 64 20 6f 6e 20 57 39 78 20 6f 72 20 orted on W9x or 3790: 57 69 6e 43 45 2e 0d 0a 20 2a 20 48 6f 77 65 76 WinCE... * Howev 37a0: 65 72 2c 20 63 6f 64 65 20 75 73 69 6e 67 20 57 er, code using W 37b0: 69 6e 53 6f 63 6b 20 31 2e 31 20 41 50 49 20 6d inSock 1.1 API m 37c0: 61 79 20 65 78 70 65 63 74 20 74 68 65 20 64 65 ay expect the de 37d0: 63 6c 61 72 61 74 69 6f 6e 73 20 61 6e 64 0d 0a clarations and.. 37e0: 20 2a 20 61 73 73 6f 63 69 61 74 65 64 20 64 65 * associated de 37f0: 66 69 6e 65 73 20 74 6f 20 62 65 20 69 6e 20 74 fines to be in t 3800: 68 69 73 20 68 65 61 64 65 72 2e 20 54 68 75 73 his header. Thus 3810: 20 77 65 20 69 6e 63 6c 75 64 65 20 6d 73 77 73 we include msws 3820: 6f 63 6b 2e 68 20 68 65 72 65 2e 0d 0a 20 2a 0d ock.h here... *. 3830: 0a 20 2a 20 57 68 65 6e 20 6c 69 6e 6b 69 6e 67 . * When linking 3840: 20 61 67 61 69 6e 73 74 20 74 68 65 20 57 69 6e against the Win 3850: 53 6f 63 6b 20 31 2e 31 20 6c 69 62 2c 20 77 73 Sock 1.1 lib, ws 3860: 6f 63 6b 33 32 2e 64 6c 6c 2c 20 74 68 65 20 6d ock32.dll, the m 3870: 73 77 73 6f 63 6b 20 66 75 6e 63 74 69 6f 6e 73 swsock functions 3880: 0d 0a 20 2a 20 61 72 65 20 61 75 74 6f 6d 61 74 .. * are automat 3890: 69 63 61 6c 6c 79 20 72 6f 75 74 65 64 20 74 6f ically routed to 38a0: 20 6d 73 77 73 6f 63 6b 2e 64 6c 6c 20 28 6f 6e mswsock.dll (on 38b0: 20 70 6c 61 74 66 6f 72 6d 73 20 77 69 74 68 20 platforms with 38c0: 73 75 70 70 6f 72 74 29 2e 0d 0a 20 2a 20 54 68 support)... * Th 38d0: 65 20 57 69 6e 53 6f 63 6b 20 32 20 6c 69 62 2c e WinSock 2 lib, 38e0: 20 77 73 32 5f 33 32 2e 64 6c 6c 2c 20 64 6f 65 ws2_32.dll, doe 38f0: 73 20 6e 6f 74 20 63 6f 6e 74 61 69 6e 20 61 6e s not contain an 3900: 79 20 72 65 66 65 72 65 6e 63 65 73 20 74 6f 0d y references to. 3910: 0a 20 2a 20 74 68 65 20 6d 73 77 73 6f 63 6b 20 . * the mswsock 3920: 65 78 74 65 6e 73 69 6f 6e 73 2e 0d 0a 20 2a 2f extensions... */ 3930: 0d 0a 0d 0a 69 6d 70 6f 72 74 20 77 69 6e 33 32 ....import win32 3940: 2e 6d 73 77 73 6f 63 6b 3b 0d 0a .mswsock;..