Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

simplify default TCP/HTTPServer construction

  • Loading branch information...
commit 639842fd29da0d6aa40f02de1eac69a74c34d488 1 parent 5cde6d3
@aleks-f aleks-f authored
View
12 Net/include/Poco/Net/HTTPServer.h
@@ -73,6 +73,14 @@ class Net_API HTTPServer: public TCPServer
/// information about the HTTP protocol.
{
public:
+ HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::UInt16 portNumber = 80, HTTPServerParams::Ptr pParams = new HTTPServerParams);
+ /// Creates HTTPServer listening on the given port (default 80).
+ ///
+ /// The server takes ownership of the HTTPRequstHandlerFactory
+ /// and deletes it when it's no longer needed.
+ ///
+ /// New threads are taken from the default thread pool.
+
HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& socket, HTTPServerParams::Ptr pParams);
/// Creates the HTTPServer, using the given ServerSocket.
///
@@ -81,7 +89,7 @@ class Net_API HTTPServer: public TCPServer
///
/// The server also takes ownership of the HTTPServerParams object.
///
- /// News threads are taken from the default thread pool.
+ /// New threads are taken from the default thread pool.
HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::ThreadPool& threadPool, const ServerSocket& socket, HTTPServerParams::Ptr pParams);
/// Creates the HTTPServer, using the given ServerSocket.
@@ -91,7 +99,7 @@ class Net_API HTTPServer: public TCPServer
///
/// The server also takes ownership of the HTTPServerParams object.
///
- /// News threads are taken from the given thread pool.
+ /// New threads are taken from the given thread pool.
~HTTPServer();
/// Destroys the HTTPServer and its HTTPRequestHandlerFactory.
View
23 Net/include/Poco/Net/TCPServer.h
@@ -98,6 +98,20 @@ class Net_API TCPServer: public Poco::Runnable
/// Already served connections, however, will continue being served.
{
public:
+ TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 portNumber = 0, TCPServerParams::Ptr pParams = 0);
+ /// Creates the TCPServer, with ServerSocket listening on the given port.
+ /// Default port is zero, allowing any availble port. The port number
+ /// can be queried through TCPServer::port() member.
+ ///
+ /// The server takes ownership of the TCPServerConnectionFactory
+ /// and deletes it when it's no longer needed.
+ ///
+ /// The server also takes ownership of the TCPServerParams object.
+ /// If no TCPServerParams object is given, the server's TCPServerDispatcher
+ /// creates its own one.
+ ///
+ /// New threads are taken from the default thread pool.
+
TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& socket, TCPServerParams::Ptr pParams = 0);
/// Creates the TCPServer, using the given ServerSocket.
///
@@ -163,6 +177,9 @@ class Net_API TCPServer: public Poco::Runnable
int refusedConnections() const;
/// Returns the number of refused connections.
+ const ServerSocket& socket() const;
+ /// Returns the underlying server socket.
+
Poco::UInt16 port() const;
/// Returns the port the server socket listens on.
@@ -188,6 +205,12 @@ class Net_API TCPServer: public Poco::Runnable
};
+inline const ServerSocket& TCPServer::socket() const
+{
+ return _socket;
+}
+
+
inline Poco::UInt16 TCPServer::port() const
{
return _socket.address().port();
View
137 Net/samples/HTTPTimeServer/HTTPTimeServer_vs110.vcxproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug_shared|Win32">
@@ -32,86 +32,89 @@
<RootNamespace>HTTPTimeServer</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;" Label="Configuration">
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;" Label="Configuration">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
- <ImportGroup Label="ExtensionSettings"/>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings" />
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;" Label="PropertySheets">
- <Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="PropertySheets">
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
- <PropertyGroup Label="UserMacros"/>
+ <PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">bin\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">obj\$(Configuration)\</IntDir>
- <LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">true</LinkIncremental>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">bin\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">obj\$(Configuration)\</IntDir>
- <LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">false</LinkIncremental>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">bin\static_mt\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">obj\$(Configuration)\</IntDir>
- <LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">true</LinkIncremental>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">bin\static_mt\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">obj\$(Configuration)\</IntDir>
- <LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">false</LinkIncremental>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">bin\static_md\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">obj\$(Configuration)\</IntDir>
- <LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">true</LinkIncremental>
- <OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">bin\static_md\</OutDir>
- <IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">obj\$(Configuration)\</IntDir>
- <LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">false</LinkIncremental>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">HTTPTimeServerd</TargetName>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">HTTPTimeServerd</TargetName>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">HTTPTimeServerd</TargetName>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">HTTPTimeServer</TargetName>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">HTTPTimeServer</TargetName>
- <TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">HTTPTimeServer</TargetName>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">obj\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">bin\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">obj\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">bin\static_mt\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">obj\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">bin\static_mt\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">obj\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">bin\static_md\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">obj\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">bin\static_md\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">obj\$(Configuration)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">false</LinkIncremental>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">HTTPTimeServerd</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">HTTPTimeServerd</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">HTTPTimeServerd</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">HTTPTimeServer</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">HTTPTimeServer</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">HTTPTimeServer</TargetName>
</PropertyGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">
+ <LibraryPath>$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);</LibraryPath>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -124,7 +127,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@@ -141,7 +144,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@@ -156,9 +159,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat/>
+ <DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -173,7 +176,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -186,7 +189,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@@ -203,7 +206,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@@ -218,9 +221,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat/>
+ <DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -235,7 +238,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Net\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@@ -248,7 +251,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@@ -265,7 +268,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@@ -280,9 +283,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
- <PrecompiledHeader/>
+ <PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
- <DebugInformationFormat/>
+ <DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -298,11 +301,11 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
- <None Include="HTTPTimeServer.properties"/>
+ <None Include="HTTPTimeServer.properties" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\HTTPTimeServer.cpp"/>
+ <ClCompile Include="src\HTTPTimeServer.cpp" />
</ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
- <ImportGroup Label="ExtensionTargets"/>
-</Project>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets" />
+</Project>
View
7 Net/src/HTTPServer.cpp
@@ -42,6 +42,13 @@ namespace Poco {
namespace Net {
+HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, Poco::UInt16 portNumber, HTTPServerParams::Ptr pParams):
+ TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), portNumber, pParams),
+ _pFactory(pFactory)
+{
+}
+
+
HTTPServer::HTTPServer(HTTPRequestHandlerFactory::Ptr pFactory, const ServerSocket& socket, HTTPServerParams::Ptr pParams):
TCPServer(new HTTPServerConnectionFactory(pParams, pFactory), socket, pParams),
_pFactory(pFactory)
View
9 Net/src/TCPServer.cpp
@@ -50,6 +50,15 @@ namespace Poco {
namespace Net {
+TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, Poco::UInt16 portNumber, TCPServerParams::Ptr pParams):
+ _socket(ServerSocket(portNumber)),
+ _pDispatcher(new TCPServerDispatcher(pFactory, Poco::ThreadPool::defaultPool(), pParams)),
+ _thread(threadName(_socket)),
+ _stopped(true)
+{
+}
+
+
TCPServer::TCPServer(TCPServerConnectionFactory::Ptr pFactory, const ServerSocket& socket, TCPServerParams::Ptr pParams):
_socket(socket),
_pDispatcher(new TCPServerDispatcher(pFactory, Poco::ThreadPool::defaultPool(), pParams)),
View
14 Net/testsuite/src/HTTPServerTest.cpp
@@ -253,13 +253,10 @@ void HTTPServerTest::testClosedRequest()
void HTTPServerTest::testIdentityRequestKeepAlive()
{
- ServerSocket svs(0);
- HTTPServerParams* pParams = new HTTPServerParams;
- pParams->setKeepAlive(true);
- HTTPServer srv(new RequestHandlerFactory, svs, pParams);
+ HTTPServer srv(new RequestHandlerFactory);
srv.start();
- HTTPClientSession cs("localhost", svs.address().port());
+ HTTPClientSession cs("localhost", srv.socket().address().port());
cs.setKeepAlive(true);
std::string body(5000, 'x');
HTTPRequest request("POST", "/echoBody", HTTPMessage::HTTP_1_1);
@@ -322,13 +319,10 @@ void HTTPServerTest::testChunkedRequestKeepAlive()
void HTTPServerTest::testClosedRequestKeepAlive()
{
- ServerSocket svs(0);
- HTTPServerParams* pParams = new HTTPServerParams;
- pParams->setKeepAlive(true);
- HTTPServer srv(new RequestHandlerFactory, svs, pParams);
+ HTTPServer srv(new RequestHandlerFactory);
srv.start();
- HTTPClientSession cs("localhost", svs.address().port());
+ HTTPClientSession cs("localhost", srv.socket().address().port());//svs.address().port());
std::string body(5000, 'x');
HTTPRequest request("POST", "/echoBody");
request.setContentType("text/plain");
View
10 Net/testsuite/src/TCPServerTest.cpp
@@ -97,15 +97,14 @@ TCPServerTest::~TCPServerTest()
void TCPServerTest::testOneConnection()
{
- ServerSocket svs(0);
- TCPServer srv(new TCPServerConnectionFactoryImpl<EchoConnection>(), svs);
+ TCPServer srv(new TCPServerConnectionFactoryImpl<EchoConnection>());
srv.start();
assert (srv.currentConnections() == 0);
assert (srv.currentThreads() == 0);
assert (srv.queuedConnections() == 0);
assert (srv.totalConnections() == 0);
- SocketAddress sa("localhost", svs.address().port());
+ SocketAddress sa("localhost", srv.socket().address().port());
StreamSocket ss1(sa);
std::string data("hello, world");
ss1.sendBytes(data.data(), (int) data.size());
@@ -125,15 +124,14 @@ void TCPServerTest::testOneConnection()
void TCPServerTest::testTwoConnections()
{
- ServerSocket svs(0);
- TCPServer srv(new TCPServerConnectionFactoryImpl<EchoConnection>(), svs);
+ TCPServer srv(new TCPServerConnectionFactoryImpl<EchoConnection>());
srv.start();
assert (srv.currentConnections() == 0);
assert (srv.currentThreads() == 0);
assert (srv.queuedConnections() == 0);
assert (srv.totalConnections() == 0);
- SocketAddress sa("localhost", svs.address().port());
+ SocketAddress sa("localhost", srv.socket().address().port());
StreamSocket ss1(sa);
StreamSocket ss2(sa);
std::string data("hello, world");
Please sign in to comment.
Something went wrong with that request. Please try again.