# Poco

# namespace Net

## Overview

Classes: AbstractHTTPRequestHandler, AcceptCertificateHandler, CertificateHandlerFactory, CertificateHandlerFactoryImpl, CertificateHandlerFactoryMgr, CertificateHandlerFactoryRegistrar, CertificateValidationException, ConnectionAbortedException, ConnectionRefusedException, ConnectionResetException, ConsoleCertificateHandler, Context, DNS, DNSException, DatagramSocket, DatagramSocketImpl, DialogSocket, ErrorNotification, FTPClientSession, FTPException, FTPPasswordProvider, FTPStreamFactory, FilePartSource, FilePartStore, FilePartStoreFactory, HTMLForm, HTMLFormException, HTTPAuthenticationParams, HTTPBasicCredentials, HTTPBufferAllocator, HTTPChunkedIOS, HTTPChunkedInputStream, HTTPChunkedOutputStream, HTTPChunkedStreamBuf, HTTPClientSession, HTTPCookie, HTTPCredentials, HTTPDigestCredentials, HTTPException, HTTPFixedLengthIOS, HTTPFixedLengthInputStream, HTTPFixedLengthOutputStream, HTTPFixedLengthStreamBuf, HTTPHeaderIOS, HTTPHeaderInputStream, HTTPHeaderOutputStream, HTTPHeaderStreamBuf, HTTPIOS, HTTPInputStream, HTTPMessage, HTTPOutputStream, HTTPRequest, HTTPRequestHandler, HTTPRequestHandlerFactory, HTTPResponse, HTTPResponseIOS, HTTPResponseStream, HTTPResponseStreamBuf, HTTPSClientSession, HTTPSSessionInstantiator, HTTPSStreamFactory, HTTPServer, HTTPServerConnection, HTTPServerConnectionFactory, HTTPServerParams, HTTPServerRequest, HTTPServerRequestImpl, HTTPServerResponse, HTTPServerResponseImpl, HTTPServerSession, HTTPSession, HTTPSessionFactory, HTTPSessionInstantiator, HTTPStreamBuf, HTTPStreamFactory, HostEntry, HostNotFoundException, ICMPClient, ICMPEventArgs, ICMPException, ICMPPacket, ICMPPacketImpl, ICMPSocket, ICMPSocketImpl, ICMPv4PacketImpl, IPAddress, IdleNotification, InterfaceNotFoundException, InvalidAddressException, InvalidCertificateException, InvalidCertificateHandler, InvalidSocketException, KeyConsoleHandler, KeyFileHandler, MailIOS, MailInputStream, MailMessage, MailOutputStream, MailRecipient, MailStreamBuf, MediaType, MessageException, MessageHeader, MulticastSocket, MultipartException, MultipartIOS, MultipartInputStream, MultipartReader, MultipartStreamBuf, MultipartWriter, NTPClient, NTPEventArgs, NTPException, NTPPacket, NameValueCollection, NetException, NetworkInterface, NoAddressFoundException, NoMessageException, NotAuthenticatedException, NullPartHandler, OAuth10Credentials, OAuth20Credentials, POP3ClientSession, POP3Exception, ParallelSocketAcceptor, ParallelSocketReactor, PartHandler, PartSource, PartStore, PartStoreFactory, PrivateKeyFactory, PrivateKeyFactoryImpl, PrivateKeyFactoryMgr, PrivateKeyFactoryRegistrar, PrivateKeyPassphraseHandler, QuotedPrintableDecoder, QuotedPrintableDecoderBuf, QuotedPrintableDecoderIOS, QuotedPrintableEncoder, QuotedPrintableEncoderBuf, QuotedPrintableEncoderIOS, RawSocket, RawSocketImpl, ReadableNotification, RejectCertificateHandler, RemoteSyslogChannel, RemoteSyslogListener, SMTPChannel, SMTPClientSession, SMTPException, SSLConnectionUnexpectedlyClosedException, SSLContextException, SSLException, SSLManager, SecureSMTPClientSession, SecureServerSocket, SecureServerSocketImpl, SecureSocketImpl, SecureStreamSocket, SecureStreamSocketImpl, ServerSocket, ServerSocketImpl, ServiceNotFoundException, Session, ShutdownNotification, Socket, SocketAcceptor, SocketAddress, SocketConnector, SocketIOS, SocketImpl, SocketInputStream, SocketNotification, SocketNotifier, SocketOutputStream, SocketReactor, SocketStream, SocketStreamBuf, StreamSocket, StreamSocketImpl, StringPartSource, TCPServer, TCPServerConnection, TCPServerConnectionFactory, TCPServerConnectionFactoryImpl, TCPServerDispatcher, TCPServerParams, TimeoutNotification, UnsupportedFamilyException, UnsupportedRedirectException, Utility, VerificationErrorArgs, WebSocket, WebSocketException, WebSocketImpl, WritableNotification, X509Certificate

Types: HTTPBasicStreamBuf

Functions: initializeNetwork, initializeSSL, operator <<, operator >>, swap, uninitializeNetwork, uninitializeSSL

## Classes

### class AbstractHTTPRequestHandler

The abstract base class for AbstractHTTPRequestHandlers created by HTTPServer.

### class AcceptCertificateHandler

A AcceptCertificateHandler is invoked whenever an error occurs verifying the certificate.

### class CertificateHandlerFactory

A CertificateHandlerFactory is responsible for creating InvalidCertificateHandlers.

### class CertificateHandlerFactoryImpl

### class CertificateHandlerFactoryMgr

A CertificateHandlerFactoryMgr manages all existing CertificateHandlerFactories.

### class CertificateHandlerFactoryRegistrar

Registrar class which automatically registers CertificateHandlerFactory at the CertificateHandlerFactoryMgr.

### class CertificateValidationException

### class ConnectionAbortedException

### class ConnectionRefusedException

### class ConnectionResetException

### class ConsoleCertificateHandler

A ConsoleCertificateHandler is invoked whenever an error occurs verifying the certificate.

### class Context

This class encapsulates context information for an SSL server or client, such as the certificate verification mode and the location of certificates and private key files, as well as the list of supported ciphers.

### class DNS

This class provides an interface to the domain name service.

### class DNSException

### class DatagramSocket

This class provides an interface to an UDP stream socket.

### class DatagramSocketImpl

This class implements an UDP socket.

### class DialogSocket

DialogSocket is a subclass of StreamSocket that can be used for implementing request-response based client server connections.

### class ErrorNotification

This notification is sent if a socket has signalled an error.

### class FTPClientSession

This class implements an File Transfer Protocol (FTP, RFC 959) client.

### class FTPException

### class FTPPasswordProvider

The base class for all password providers.

### class FTPStreamFactory

An implementation of the URIStreamFactory interface that handles File Transfer Protocol (ftp) URIs.

### class FilePartSource

An implementation of PartSource for plain files.

### class FilePartStore

An implementation of PartSource for persisting parts (usually email attachment files) to the file system.

### class FilePartStoreFactory

### class HTMLForm

HTMLForm is a helper class for working with HTML forms, both on the client and on the server side.

### class HTMLFormException

### class HTTPAuthenticationParams

Collection of name-value pairs of HTTP authentication header (i.

### class HTTPBasicCredentials

This is a utility class for working with HTTP Basic Authentication in HTTPRequest objects.

### class HTTPBufferAllocator

A BufferAllocator for HTTP streams.

### class HTTPChunkedIOS

The base class for HTTPInputStream.

### class HTTPChunkedInputStream

This class is for internal use by HTTPSession only.

### class HTTPChunkedOutputStream

This class is for internal use by HTTPSession only.

### class HTTPChunkedStreamBuf

This is the streambuf class used for reading and writing HTTP message bodies in chunked transfer coding.

### class HTTPClientSession

This class implements the client-side of a HTTP session.

### class HTTPCookie

This class represents a HTTP Cookie.

### class HTTPCredentials

This is a utility class for working with HTTP authentication (basic or digest) in HTTPRequest objects.

### class HTTPDigestCredentials

This is a utility class for working with HTTP Digest Authentication in HTTPRequest objects.

### class HTTPException

### class HTTPFixedLengthIOS

The base class for HTTPFixedLengthInputStream.

### class HTTPFixedLengthInputStream

This class is for internal use by HTTPSession only.

### class HTTPFixedLengthOutputStream

This class is for internal use by HTTPSession only.

### class HTTPFixedLengthStreamBuf

This is the streambuf class used for reading and writing fixed-size HTTP message bodies.

### class HTTPHeaderIOS

The base class for HTTPHeaderInputStream.

### class HTTPHeaderInputStream

This class is for internal use by HTTPSession only.

### class HTTPHeaderOutputStream

This class is for internal use by HTTPSession only.

### class HTTPHeaderStreamBuf

This is the streambuf class used for reading from a HTTP header in a HTTPSession.

### class HTTPIOS

The base class for HTTPInputStream.

### class HTTPInputStream

This class is for internal use by HTTPSession only.

### class HTTPMessage

The base class for HTTPRequest and HTTPResponse.

### class HTTPOutputStream

This class is for internal use by HTTPSession only.

### class HTTPRequest

This class encapsulates an HTTP request message.

### class HTTPRequestHandler

The abstract base class for HTTPRequestHandlers created by HTTPServer.

### class HTTPRequestHandlerFactory

A factory for HTTPRequestHandler objects.

### class HTTPResponse

This class encapsulates an HTTP response message.

### class HTTPResponseIOS

### class HTTPResponseStream

### class HTTPResponseStreamBuf

### class HTTPSClientSession

This class implements the client-side of a HTTPS session.

### class HTTPSSessionInstantiator

The HTTPSessionInstantiator for HTTPSClientSession.

### class HTTPSStreamFactory

An implementation of the URIStreamFactory interface that handles secure Hyper-Text Transfer Protocol (https) URIs.

### class HTTPServer

A subclass of TCPServer that implements a full-featured multithreaded HTTP server.

### class HTTPServerConnection

This subclass of TCPServerConnection handles HTTP connections.

### class HTTPServerConnectionFactory

This implementation of a TCPServerConnectionFactory is used by HTTPServer to create HTTPServerConnection objects.

### class HTTPServerParams

This class is used to specify parameters to both the HTTPServer, as well as to HTTPRequestHandler objects.

### class HTTPServerRequest

This abstract subclass of HTTPRequest is used for representing server-side HTTP requests.

### class HTTPServerRequestImpl

This subclass of HTTPServerRequest is used for representing server-side HTTP requests.

### class HTTPServerResponse

This subclass of HTTPResponse is used for representing server-side HTTP responses.

### class HTTPServerResponseImpl

This subclass of HTTPServerResponse is used for representing server-side HTTP responses.

### class HTTPServerSession

This class handles the server side of a HTTP session.

### class HTTPSession

HTTPSession implements basic HTTP session management for both HTTP clients and HTTP servers.

### class HTTPSessionFactory

A factory for HTTPClientSession objects.

### class HTTPSessionInstantiator

A factory for HTTPClientSession objects.

### class HTTPStreamBuf

This is the streambuf class used for reading and writing HTTP message bodies.

### class HTTPStreamFactory

An implementation of the URIStreamFactory interface that handles Hyper-Text Transfer Protocol (http) URIs.

### class HostEntry

This class stores information about a host such as host name, alias names and a list of IP addresses.

### class HostNotFoundException

### class ICMPClient

This class provides ICMP Ping functionality.

### class ICMPEventArgs

The purpose of the ICMPEventArgs class is to be used as template parameter to instantiate event members in ICMPClient class.

### class ICMPException

### class ICMPPacket

This class is the ICMP packet abstraction.

### class ICMPPacketImpl

This is the abstract class for ICMP packet implementations.

### class ICMPSocket

This class provides an interface to an ICMP client socket.

### class ICMPSocketImpl

This class implements an ICMP socket.

### class ICMPv4PacketImpl

This class implements the ICMPv4 packet.

### class IPAddress

This class represents an internet (IP) host address.

### class IdleNotification

This notification is sent when the SocketReactor does not have any sockets to react to.

### class InterfaceNotFoundException

### class InvalidAddressException

### class InvalidCertificateException

### class InvalidCertificateHandler

A InvalidCertificateHandler is invoked whenever an error occurs verifying the certificate.

### class InvalidSocketException

### class KeyConsoleHandler

An implementation of PrivateKeyPassphraseHandler that reads the key for a certificate from the console.

### class KeyFileHandler

An implementation of PrivateKeyPassphraseHandler that reads the key for a certificate from a configuration file under the path "openSSL.

### class MailIOS

The base class for MailInputStream and MailOutputStream.

### class MailInputStream

This class is used for reading E-Mail messages from a POP3 server.

### class MailMessage

This class represents an e-mail message for use with the SMTPClientSession and POPClientSession classes.

### class MailOutputStream

This class is used for writing E-Mail messages to a SMTP server.

### class MailRecipient

The recipient of an e-mail message.

### class MailStreamBuf

The sole purpose of this stream buffer is to replace a "\r\n.

### class MediaType

This class represents a MIME media type, consisting of a top-level type, a subtype and an optional set of parameters.

### class MessageException

### class MessageHeader

A collection of name-value pairs that are used in various internet protocols like HTTP and SMTP.

### class MulticastSocket

A MulticastSocket is a special DatagramSocket that can be used to send packets to and receive packets from multicast groups.

### class MultipartException

### class MultipartIOS

The base class for MultipartInputStream.

### class MultipartInputStream

This class is for internal use by MultipartReader only.

### class MultipartReader

This class is used to split a MIME multipart message into its single parts.

### class MultipartStreamBuf

This is the streambuf class used for reading from a multipart message stream.

### class MultipartWriter

This class is used to write MIME multipart messages to an output stream.

### class NTPClient

This class provides NTP (Network Time Protocol) client functionality.

### class NTPEventArgs

The purpose of the NTPEventArgs class is to be used as template parameter to instantiate event members in NTPClient class.

### class NTPException

### class NTPPacket

This class is the NTP packet abstraction.

### class NameValueCollection

A collection of name-value pairs that are used in various internet protocols like HTTP and SMTP.

### class NetException

### class NetworkInterface

This class represents a network interface.

### class NoAddressFoundException

### class NoMessageException

### class NotAuthenticatedException

### class NullPartHandler

A very special PartHandler that simply discards all data.

### class OAuth10Credentials

This class implements OAuth 1.

### class OAuth20Credentials

This class implements OAuth 2.

### class POP3ClientSession

This class implements an Post Office Protocol Version 3 (POP3, RFC 1939) client for receiving e-mail messages.

### class POP3Exception

### class ParallelSocketAcceptor

This class implements the Acceptor part of the Acceptor-Connector design pattern.

### class ParallelSocketReactor

### class PartHandler

The base class for all part or attachment handlers.

### class PartSource

This abstract class is used for adding parts or attachments to mail messages, as well as for uploading files as part of a HTML form.

### class PartStore

A parent class for part stores storing message parts.

### class PartStoreFactory

Parent factory class for part stores creation.

### class PrivateKeyFactory

A PrivateKeyFactory is responsible for creating PrivateKeyPassphraseHandlers.

### class PrivateKeyFactoryImpl

### class PrivateKeyFactoryMgr

A PrivateKeyFactoryMgr manages all existing PrivateKeyFactories.

### class PrivateKeyFactoryRegistrar

Registrar class which automatically registers PrivateKeyFactories at the PrivateKeyFactoryMgr.

### class PrivateKeyPassphraseHandler

A passphrase handler is needed whenever the private key of a certificate is loaded and the certificate is protected by a passphrase.

### class QuotedPrintableDecoder

This istream decodes all quoted-printable (see RFC 2045) encoded data read from the istream connected to it.

### class QuotedPrintableDecoderBuf

This streambuf decodes all quoted-printable (see RFC 2045) encoded data read from the istream connected to it.

### class QuotedPrintableDecoderIOS

The base class for QuotedPrintableDecoder.

### class QuotedPrintableEncoder

This ostream encodes all data written to it in quoted-printable encoding (see RFC 2045) and forwards it to a connected ostream.

### class QuotedPrintableEncoderBuf

This streambuf encodes all data written to it in quoted-printable encoding (see RFC 2045) and forwards it to a connected ostream.

### class QuotedPrintableEncoderIOS

The base class for QuotedPrintableEncoder.

### class RawSocket

This class provides an interface to a raw IP socket.

### class RawSocketImpl

This class implements a raw socket.

### class ReadableNotification

This notification is sent if a socket has become readable.

### class RejectCertificateHandler

A RejectCertificateHandler is invoked whenever an error occurs verifying the certificate.

### class RemoteSyslogChannel

This Channel implements remote syslog logging over UDP according to RFC 5424 "The Syslog Protocol" and RFC 5426 "Transmission of syslog messages over UDP".

### class RemoteSyslogListener

RemoteSyslogListener implements listening for syslog messages sent over UDP, according to RFC 5424 "The Syslog Protocol" and RFC 5426 "Transmission of syslog messages over UDP".

### class SMTPChannel

This Channel implements SMTP (email) logging.

### class SMTPClientSession

This class implements an Simple Mail Transfer Procotol (SMTP, RFC 2821) client for sending e-mail messages.

### class SMTPException

### class SSLConnectionUnexpectedlyClosedException

### class SSLContextException

### class SSLException

### class SSLManager

SSLManager is a singleton for holding the default server/client Context and handling callbacks for certificate verification errors and private key passphrases.

### class SecureSMTPClientSession

This class implements an Simple Mail Transfer Procotol (SMTP, RFC 2821) client for sending e-mail messages that supports the STARTTLS command for secure connections.

### class SecureServerSocket

A server socket for secure SSL connections.

### class SecureServerSocketImpl

The SocketImpl class for SecureServerSocket.

### class SecureSocketImpl

The SocketImpl for SecureStreamSocket.

### class SecureStreamSocket

A subclass of StreamSocket for secure SSL sockets.

### class SecureStreamSocketImpl

This class implements a SSL stream socket.

### class ServerSocket

This class provides an interface to a TCP server socket.

### class ServerSocketImpl

This class implements a TCP server socket.

### class ServiceNotFoundException

### class Session

This class encapsulates a SSL session object used with session caching on the client side.

### class ShutdownNotification

This notification is sent when the SocketReactor is about to shut down.

### class Socket

Socket is the common base class for StreamSocket, ServerSocket, DatagramSocket and other socket classes.

### class SocketAcceptor

This class implements the Acceptor part of the Acceptor-Connector design pattern.

### class SocketAddress

This class represents an internet (IP) endpoint/socket address.

### class SocketConnector

This class implements the Connector part of the Acceptor-Connector design pattern.

### class SocketIOS

The base class for SocketStream, SocketInputStream and SocketOutputStream.

### class SocketImpl

This class encapsulates the Berkeley sockets API.

### class SocketInputStream

An input stream for reading from a socket.

### class SocketNotification

The base class for all notifications generated by the SocketReactor.

### class SocketNotifier

This class is used internally by SocketReactor to notify registered event handlers of socket events.

### class SocketOutputStream

An output stream for writing to a socket.

### class SocketReactor

This class, which is part of the Reactor pattern, implements the "Initiation Dispatcher".

### class SocketStream

An bidirectional stream for reading from and writing to a socket.

### class SocketStreamBuf

This is the streambuf class used for reading from and writing to a socket.

### class StreamSocket

This class provides an interface to a TCP stream socket.

### class StreamSocketImpl

This class implements a TCP socket.

### class StringPartSource

An implementation of PartSource for strings.

### class TCPServer

This class implements a multithreaded TCP server.

### class TCPServerConnection

The abstract base class for TCP server connections created by TCPServer.

### class TCPServerConnectionFactory

A factory for TCPServerConnection objects.

### class TCPServerConnectionFactoryImpl

This template provides a basic implementation of TCPServerConnectionFactory.

### class TCPServerDispatcher

A helper class for TCPServer that dispatches connections to server connection threads.

### class TCPServerParams

This class is used to specify parameters to both the TCPServer, as well as to TCPServerDispatcher objects.

### class TimeoutNotification

This notification is sent if no other event has occured for a specified time.

### class UnsupportedFamilyException

### class UnsupportedRedirectException

### class Utility

This class provides various helper functions for working with the OpenSSL library.

### class VerificationErrorArgs

A utility class for certificate error handling.

### class WebSocket

This class implements a WebSocket according to the WebSocket protocol specification in RFC 6455.

### class WebSocketException

### class WebSocketImpl

This class implements a WebSocket, according to the WebSocket protocol described in RFC 6455.

### class WritableNotification

This notification is sent if a socket has become writable.

### class X509Certificate

This class extends Poco::Crypto::X509Certificate with the feature to validate a certificate.

## Types

### HTTPBasicStreamBuf

typedef Poco::BasicBufferedStreamBuf < char, std::char_traits < char >, HTTPBufferAllocator > HTTPBasicStreamBuf;

## Functions

### initializeNetwork

void initializeNetwork();

Initialize the network subsystem. (Windows only, no-op elsewhere)

### initializeSSL

void initializeSSL();

Initialize the NetSSL library, as well as the underlying OpenSSL libraries, by calling Poco::Crypto::OpenSSLInitializer::initialize().

Should be called before using any class from the NetSSL library. The NetSSL will be initialized automatically, through Poco::Crypto::OpenSSLInitializer instances or similar mechanisms when creating Context or SSLManager instances. However, it is recommended to call initializeSSL() in any case at application startup.

Can be called multiple times; however, for every call to initializeSSL(), a matching call to uninitializeSSL() must be performed.

### operator <<

BinaryWriter & operator << (
BinaryWriter & writer,
const IPAddress & value
);

### operator >>

BinaryReader & operator >> (
BinaryReader & reader,
IPAddress & value
);

### swap

inline void swap(
HostEntry & h1,
HostEntry & h2
);

### swap

inline void swap(
MailRecipient & r1,
MailRecipient & r2
);

### swap

inline void swap(
MediaType & m1,
MediaType & m2
);

### swap

inline void swap(
NameValueCollection & nvc1,
NameValueCollection & nvc2
);

### uninitializeNetwork

void uninitializeNetwork();

Uninitialize the network subsystem. (Windows only, no-op elsewhere)

### uninitializeSSL

void uninitializeSSL();

Uninitializes the NetSSL library by calling Poco::Crypto::OpenSSLInitializer::uninitialize() and shutting down the SSLManager.