Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 90273 invoked from network); 9 Feb 2006 03:34:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Feb 2006 03:34:02 -0000 Received: (qmail 42658 invoked by uid 500); 9 Feb 2006 03:34:00 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 42612 invoked by uid 500); 9 Feb 2006 03:33:59 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 42601 invoked by uid 500); 9 Feb 2006 03:33:59 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 42598 invoked by uid 99); 9 Feb 2006 03:33:59 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2006 19:33:59 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 08 Feb 2006 19:33:59 -0800 Received: (qmail 90153 invoked by uid 65534); 9 Feb 2006 03:33:38 -0000 Message-ID: <20060209033338.90152.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r376173 - /webservices/axis2/trunk/c/modules/util/network_handler.c Date: Thu, 09 Feb 2006 03:33:38 -0000 To: axis2-cvs@ws.apache.org From: damitha@apache.org X-Mailer: svnmailer-1.0.6 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: damitha Date: Wed Feb 8 19:33:36 2006 New Revision: 376173 URL: http://svn.apache.org/viewcvs?rev=376173&view=rev Log: init code for windows added Modified: webservices/axis2/trunk/c/modules/util/network_handler.c Modified: webservices/axis2/trunk/c/modules/util/network_handler.c URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/network_handler.c?rev=376173&r1=376172&r2=376173&view=diff ============================================================================== --- webservices/axis2/trunk/c/modules/util/network_handler.c (original) +++ webservices/axis2/trunk/c/modules/util/network_handler.c Wed Feb 8 19:33:36 2006 @@ -22,6 +22,11 @@ #include +#if defined(WIN32) +static int is_init_socket = 0; +axis2_bool_t axis2_init_socket(); +#endif + AXIS2_DECLARE( axis2_socket_t ) axis2_network_handler_open_socket(axis2_env_t **env, char *server, int port) { @@ -29,10 +34,18 @@ struct sockaddr_in sock_addr; struct linger ll; int nodelay = 1; - - AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE); + +#if defined(WIN32) +if (is_init_socket == 0) +{ + axis2_init_socket(); + is_init_socket = 1; +} +#endif + + AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE); AXIS2_PARAM_CHECK((*env)->error, server, AXIS2_CRTICAL_FAILURE); - + if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) /*nnn AF_INET is not defined in sys/socket.h but PF_INET*/ { @@ -182,3 +195,35 @@ setsockopt(cli_socket, SOL_SOCKET, SO_LINGER , &ll, sizeof(struct linger)); return cli_socket; } + +#if defined (WIN32) +axis2_bool_t axis2_init_socket() +{ + WORD wVersionRequested; + WSADATA wsaData; + int err; + + wVersionRequested = MAKEWORD( 2, 2 ); + + err = WSAStartup( wVersionRequested, &wsaData ); + + if ( err != 0 ) + return 0; //WinSock 2.2 not found + + + // Confirm that the WinSock DLL supports 2.2. + // Note that if the DLL supports versions greater + // than 2.2 in addition to 2.2, it will still return + // 2.2 in wVersion since that is the version we + // requested. + + if ( LOBYTE( wsaData.wVersion ) != 2 || + HIBYTE( wsaData.wVersion ) != 2 ) + { + WSACleanup( ); + return 0; //WinSock 2.2 not supported + } + + return 1; +} +#endif \ No newline at end of file