Annotation of parser3/src/main/pa_socks.C, revision 1.12
1.3 paf 1: /** @file
1.1 paf 2: Parser: socks initialization/finalization.
3:
1.12 ! paf 4: Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.8 paf 5: Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)
1.1 paf 6:
1.12 ! paf 7: $Id: pa_socks.C,v 1.11 2002/02/07 17:48:12 paf Exp $
1.1 paf 8: */
1.2 paf 9:
10: #define NO_UNISTD_H
11: #include "pa_config_includes.h"
1.1 paf 12:
1.10 paf 13: #ifndef HAVE_SYS_SELECT_H
1.9 paf 14: #include "pa_exception.h"
15: #include "pa_socks.h"
1.11 paf 16:
17: #include <winsock.h>
1.9 paf 18:
1.1 paf 19: WSADATA wsaData;
20:
21: void init_socks(Pool& pool) {
22: WORD wVersionRequested;
23: int err;
24: wVersionRequested = MAKEWORD( 1, 1 );
25: //wVersionRequested = MAKEWORD( 2, 2 );
26: err = WSAStartup( wVersionRequested, &wsaData );
27: if ( err != 0 ) {
28: /* Tell the user that we could not find a usable */
29: /* WinSock DLL. */
1.7 parser 30: throw Exception(0, 0,
1.1 paf 31: 0,
32: "can not WSAStartup, err=%d",
33: err);
34: }
35: }
36:
37: void done_socks() {
38: /* Confirm that the WinSock DLL supports 2.2.*/
39: /* Note that if the DLL supports versions greater */
40: /* than 2.2 in addition to 2.2, it will still return */
41: /* 2.2 in wVersion since that is the version we */
42: /* requested. */
43: if ( LOBYTE( wsaData.wVersion ) == 2 ||
44: HIBYTE( wsaData.wVersion ) == 2 ) {
45: WSACleanup( );
46: return;
47: }
48: }
49:
50: #else
1.10 paf 51:
52: #include "pa_pool.h"
1.1 paf 53:
54: void init_socks(Pool& pool) {}
55: void done_socks() {}
56:
57: #endif
E-mail: