From: Markus R. <rol...@us...> - 2007-02-09 20:12:26
|
Update of /cvsroot/simspark/simspark/spark/utility/rcssnet In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv10831 Added Files: Tag: WIN32 handler.cpp handler.hpp rcssnet.vcproj Log Message: --- NEW FILE: rcssnet.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="8,00" Name="rcssnet" ProjectGUID="{ABCC65CE-0762-42F2-8459-41722DCF02D9}" RootNamespace="rcssnet" Keyword="Win32Proj" > <Platforms> <Platform Name="Win32" /> </Platforms> <ToolFiles> </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="4" CharacterSet="0" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\win32" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="4" CharacterSet="0" WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" PreprocessorDefinitions="WIN32;NDEBUG;_LIB" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> </Configurations> <References> </References> <Files> <File RelativePath=".\addr.cpp" > </File> <File RelativePath=".\addr.hpp" > </File> <File RelativePath=".\exception.cpp" > </File> <File RelativePath=".\exception.hpp" > </File> <File RelativePath=".\handler.cpp" > </File> <File RelativePath=".\handler.hpp" > </File> <File RelativePath=".\iosocketstream.hpp" > </File> <File RelativePath=".\isocketstream.hpp" > </File> <File RelativePath=".\osocketstream.hpp" > </File> <File RelativePath=".\socket.cpp" > </File> <File RelativePath=".\socket.hpp" > </File> <File RelativePath=".\socketstreambuf.hpp" > </File> <File RelativePath=".\tcpsocket.cpp" > </File> <File RelativePath=".\tcpsocket.hpp" > </File> <File RelativePath=".\udpsocket.cpp" > </File> <File RelativePath=".\udpsocket.hpp" > </File> </Files> <Globals> </Globals> </VisualStudioProject> --- NEW FILE: handler.hpp --- // -*-c++-*- /*************************************************************************** handler.hpp - handles network startup ------------------- begin : 14-AUG-2003 copyright : (C) 2003 by The RoboCup Soccer Server Maintenance Group. email : sse...@li... ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU LGPL as published by the Free Software * * Foundation; either version 2 of the License, or (at your option) any * * later version. * * * ***************************************************************************/ #ifndef RCSS_NET_HANDLER_HPP #define RCSS_NET_HANDLER_HPP #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(CYGWIN) #include "Winsock2.h" #endif namespace rcss { namespace net { class Handler { public: static Handler& instance(); bool valid() const { return m_valid; } private: Handler(); Handler( const Handler& ); // not used Handler& operator=( const Handler& ); // not used ~Handler(); #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(CYGWIN) WSADATA m_WSAData; #endif bool m_valid; }; } } #endif // RCSS_NET_HANDLER_HPP --- NEW FILE: handler.cpp --- // -*-c++-*- /*************************************************************************** handler.cpp - handles network startup ------------------- begin : 14-AUG-2003 copyright : (C) 2003 by The RoboCup Soccer Server Maintenance Group. email : sse...@li... ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU LGPL as published by the Free Software * * Foundation; either version 2 of the License, or (at your option) any * * later version. * * * ***************************************************************************/ #include "handler.hpp" namespace rcss { namespace net { Handler& Handler::instance() { static Handler rval; return rval; } Handler::Handler() : m_valid( true ) { #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(CYGWIN) WORD wVersionRequested; int err; wVersionRequested = MAKEWORD( 2, 2 ); err = WSAStartup( wVersionRequested, &m_WSAData ); if ( err != 0 ) { m_valid = false; return; } if ( LOBYTE( m_WSAData.wVersion ) != 2 || HIBYTE( m_WSAData.wVersion ) != 2 ) { WSACleanup(); m_valid = false; return; } #endif } Handler::~Handler() { #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(CYGWIN) WSACleanup(); #endif } } } |