socket initialization and other fixes

This commit is contained in:
Guenter Obiltschnig
2009-04-14 11:02:21 +00:00
parent 457e24748d
commit 9cb9229a4e
17 changed files with 92 additions and 49 deletions

View File

@@ -1,7 +1,7 @@
//
// DatagramSocketImpl.h
//
// $Id: //poco/svn/Net/include/Poco/Net/DatagramSocketImpl.h#2 $
// $Id: //poco/Main/Net/include/Poco/Net/DatagramSocketImpl.h#3 $
//
// Library: Net
// Package: Sockets
@@ -59,7 +59,7 @@ public:
/// be an IPv6 socket. Otherwise, it will be
/// an IPv4 socket.
DatagramSocketImpl(IPAddress::Family family);
explicit DatagramSocketImpl(IPAddress::Family family);
/// Creates an unconnected datagram socket.
///
/// The socket will be created for the

View File

@@ -1,7 +1,7 @@
//
// HTTPServerSession.h
//
// $Id: //poco/svn/Net/include/Poco/Net/HTTPServerSession.h#2 $
// $Id: //poco/Main/Net/include/Poco/Net/HTTPServerSession.h#5 $
//
// Library: Net
// Package: HTTPServer
@@ -43,6 +43,8 @@
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Net/HTTPServerSession.h"
#include "Poco/Net/HTTPServerParams.h"
#include "Poco/Timespan.h"
@@ -50,16 +52,13 @@ namespace Poco {
namespace Net {
class HTTPServerParams;
class Net_API HTTPServerSession: public HTTPSession
/// This class handles the server side of a
/// HTTP session. It is used internally by
/// HTTPServer.
{
public:
HTTPServerSession(const StreamSocket& socket, HTTPServerParams* pParams);
HTTPServerSession(const StreamSocket& socket, HTTPServerParams::Ptr pParams);
/// Creates the HTTPServerSession.
virtual ~HTTPServerSession();

View File

@@ -1,7 +1,7 @@
//
// SocketAddress.h
//
// $Id: //poco/svn/Net/include/Poco/Net/SocketAddress.h#2 $
// $Id: //poco/Main/Net/include/Poco/Net/SocketAddress.h#3 $
//
// Library: Net
// Package: NetCore
@@ -126,6 +126,9 @@ public:
std::string toString() const;
/// Returns a string representation of the address.
IPAddress::Family family() const;
/// Returns the address family of the host's address.
enum
{
MAX_ADDRESS_LENGTH =
@@ -156,6 +159,12 @@ inline void swap(SocketAddress& a1, SocketAddress& a2)
}
inline IPAddress::Family SocketAddress::family() const
{
return host().family();
}
} } // namespace Poco::Net

View File

@@ -1,7 +1,7 @@
//
// StreamSocket.h
//
// $Id: //poco/Main/Net/include/Poco/Net/StreamSocket.h#3 $
// $Id: //poco/Main/Net/include/Poco/Net/StreamSocket.h#4 $
//
// Library: Net
// Package: Sockets
@@ -66,6 +66,15 @@ public:
/// Creates a stream socket and connects it to
/// the socket specified by address.
explicit StreamSocket(IPAddress::Family family);
/// Creates an unconnected stream socket
/// for the given address family.
///
/// This is useful if certain socket options
/// (like send and receive buffer) sizes, that must
/// be set before connecting the socket, will be
/// set later on.
StreamSocket(const Socket& socket);
/// Creates the StreamSocket with the SocketImpl
/// from another socket. The SocketImpl must be

View File

@@ -1,7 +1,7 @@
//
// StreamSocketImpl.h
//
// $Id: //poco/svn/Net/include/Poco/Net/StreamSocketImpl.h#2 $
// $Id: //poco/Main/Net/include/Poco/Net/StreamSocketImpl.h#3 $
//
// Library: Net
// Package: Sockets
@@ -54,6 +54,10 @@ class Net_API StreamSocketImpl: public SocketImpl
public:
StreamSocketImpl();
/// Creates a StreamSocketImpl.
explicit StreamSocketImpl(IPAddress::Family addressFamily);
/// Creates a SocketImpl, with the underlying
/// socket initialized for the given address family.
StreamSocketImpl(poco_socket_t sockfd);
/// Creates a StreamSocketImpl using the given native socket.