- Timestamp:
- Jul 8, 2001, 5:44:27 PM (24 years ago)
- Location:
- trunk/src/wsock32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wsock32/asyncapi.cpp
r6205 r6253 1 /* $Id: asyncapi.cpp,v 1.1 4 2001-07-07 18:49:13achimha Exp $ */1 /* $Id: asyncapi.cpp,v 1.15 2001-07-08 15:44:27 achimha Exp $ */ 2 2 3 3 /* … … 671 671 return SOCKET_ERROR; 672 672 } 673 #if 0 674 // AH: null sempahore is ok when clearing request 675 else 676 if ((mode == WSA_SELECT_HEVENT) && !(WSAEVENT)notifyHandle) 677 { 678 dprintf(("invalid event semaphore handle")); 679 WSASetLastError(WSAEINVAL); // invalid parameter 680 return SOCKET_ERROR; 681 } 682 #endif 683 684 //Set socket to non-blocking mode 685 ret = ioctl(s, FIONBIO, (char *) &nonblock, sizeof(nonblock)); 673 674 // Set socket to non-blocking mode 675 ret = ioctl(s, FIONBIO, (char *)&nonblock, sizeof(nonblock)); 686 676 if(ret == SOCKET_ERROR) { 687 677 dprintf(("setting socket to non blocking mode failed")); -
trunk/src/wsock32/wsock32.cpp
r6196 r6253 1 /* $Id: wsock32.cpp,v 1.3 6 2001-07-07 10:44:10achimha Exp $ */1 /* $Id: wsock32.cpp,v 1.37 2001-07-08 15:44:27 achimha Exp $ */ 2 2 3 3 /* … … 151 151 void WIN32API WSASetLastError(int iError) 152 152 { 153 // according to the docs, WSASetLastError() is just a call-through 154 // to SetLastError() 155 if(iError) { 156 dprintf(("WSASetLastError 0x%x", iError)); 157 } 158 SetLastError(iError); 153 #ifdef DEBUG 154 char msg[20]; 155 #endif 156 // according to the docs, WSASetLastError() is just a call-through 157 // to SetLastError() 158 SetLastError(iError); 159 #ifdef DEBUG 160 switch (iError) 161 { 162 case NO_ERROR: 163 strcpy(msg, "no error"); 164 break; 165 case WSAEINTR: 166 strcpy(msg, "WSAEINTR"); 167 break; 168 case WSAEBADF: 169 strcpy(msg, "WSAEBADF"); 170 break; 171 case WSAEACCES: 172 strcpy(msg, "WSAEACCES"); 173 break; 174 case WSAEFAULT: 175 strcpy(msg, "WSAEFAULT"); 176 break; 177 case WSAEINVAL: 178 strcpy(msg, "WSAEINVAL"); 179 break; 180 case WSAEMFILE: 181 strcpy(msg, "WSAEMFILE"); 182 break; 183 case WSAEWOULDBLOCK: 184 strcpy(msg, "WSAEWOULDBLOCK"); 185 break; 186 case WSAEINPROGRESS: 187 strcpy(msg, "WSAEINPROGRESS"); 188 break; 189 case WSAEALREADY: 190 strcpy(msg, "WSAEALREADY"); 191 break; 192 default: 193 strcpy(msg, "unknown"); 194 } 195 if (iError != 0) 196 { 197 dprintf(("WSASetLastError 0x%x - %s", iError, msg)); 198 } 199 #endif 159 200 } 160 201 //****************************************************************************** … … 884 925 optval = safeoptval; 885 926 886 if (level == SOL_SOCKET) { 887 switch(optname) { 927 if (level == SOL_SOCKET) 928 { 929 switch(optname) 930 { 888 931 case SO_DONTLINGER: 889 932 case SO_LINGER: 890 if(optlen < (int)sizeof(ws_linger)) { 933 if(optlen < (int)sizeof(ws_linger)) 934 { 891 935 dprintf(("SOL_SOCKET, SO_LINGER, optlen too small")); 892 936 WSASetLastError(WSAEFAULT); … … 901 945 case SO_SNDBUF: 902 946 case SO_RCVBUF: 903 if(optlen < (int)sizeof(int)) { 947 if(optlen < (int)sizeof(int)) 948 { 904 949 dprintf(("SOL_SOCKET, SO_RCVBUF, optlen too small")); 905 950 WSASetLastError(WSAEFAULT); … … 934 979 break; 935 980 default: 936 dprintf(("setsockopt: unknown option %x", optname));981 dprintf(("setsockopt: SOL_SOCKET, unknown option %x", optname)); 937 982 WSASetLastError(WSAENOPROTOOPT); 938 983 return SOCKET_ERROR; … … 940 985 } 941 986 else 942 if(level == IPPROTO_TCP) { 987 if(level == IPPROTO_TCP) 988 { 943 989 if(optname == TCP_NODELAY) { 944 990 if(optlen < (int)sizeof(int)) { … … 950 996 } 951 997 else { 952 dprintf(("setsockopt: unknown option %x", optname));998 dprintf(("setsockopt: IPPROTO_TCP, unknown option %x", optname)); 953 999 WSASetLastError(WSAENOPROTOOPT); 954 1000 return SOCKET_ERROR; 955 1001 } 1002 } 1003 else 1004 if (level == IPPROTO_IP) 1005 { 1006 switch (optname) 1007 { 1008 case IP_MULTICAST_IF: 1009 { 1010 if (optlen < sizeof(in_addr)) 1011 { 1012 dprintf(("IPPROTO_IP, IP_MULTICAST_IP, optlen too small")); 1013 WSASetLastError(WSAEFAULT); 1014 return SOCKET_ERROR; 1015 } 1016 //TODO convert common interface names! 1017 ret = setsockopt(s, level, optname, (char *)optval, optlen); 1018 break; 1019 } 1020 1021 default: 1022 dprintf(("setsockopt: IPPROTO_IP, unknown option %x", optname)); 1023 WSASetLastError(WSAENOPROTOOPT); 1024 return SOCKET_ERROR; 1025 } 956 1026 } 957 1027 else {
Note:
See TracChangeset
for help on using the changeset viewer.