MPD  0.20.6
Public Member Functions | Protected Member Functions | Friends
ServerSocket Class Referenceabstract

A socket that accepts incoming stream connections (e.g. More...

#include <ServerSocket.hxx>

Inheritance diagram for ServerSocket:
[legend]

Public Member Functions

 ServerSocket (EventLoop &_loop)
 
 ~ServerSocket ()
 
EventLoopGetEventLoop ()
 
void AddPort (unsigned port)
 Add a listener on a port on all interfaces. More...
 
void AddHost (const char *hostname, unsigned port)
 Resolves a host name, and adds listeners on all addresses in the result set. More...
 
void AddPath (AllocatedPath &&path)
 Add a listener on a Unix domain socket. More...
 
void AddFD (int fd)
 Add a socket descriptor that is accepting connections. More...
 
void Open ()
 Throws #std::runtime_error on error. More...
 
void Close ()
 

Protected Member Functions

virtual void OnAccept (int fd, SocketAddress address, int uid)=0
 

Friends

class OneServerSocket
 

Detailed Description

A socket that accepts incoming stream connections (e.g.

TCP).

Definition at line 34 of file ServerSocket.hxx.

Constructor & Destructor Documentation

ServerSocket::ServerSocket ( EventLoop _loop)
ServerSocket::~ServerSocket ( )

Member Function Documentation

void ServerSocket::AddFD ( int  fd)

Add a socket descriptor that is accepting connections.

After this has been called, don't call server_socket_open(), because the socket is already open.

Throws #std::runtime_error on error.

void ServerSocket::AddHost ( const char *  hostname,
unsigned  port 
)

Resolves a host name, and adds listeners on all addresses in the result set.

Throws #std::runtime_error on error.

Parameters
hostnamethe host name to be resolved
portthe TCP port
errorlocation to store the error occurring
void ServerSocket::AddPath ( AllocatedPath &&  path)

Add a listener on a Unix domain socket.

Throws #std::runtime_error on error.

Parameters
paththe absolute socket path
errorlocation to store the error occurring
void ServerSocket::AddPort ( unsigned  port)

Add a listener on a port on all interfaces.

Throws #std::runtime_error on error.

Parameters
portthe TCP port
errorlocation to store the error occurring
void ServerSocket::Close ( )
EventLoop& ServerSocket::GetEventLoop ( )
inline

Definition at line 47 of file ServerSocket.hxx.

virtual void ServerSocket::OnAccept ( int  fd,
SocketAddress  address,
int  uid 
)
protectedpure virtual
void ServerSocket::Open ( )

Throws #std::runtime_error on error.

Friends And Related Function Documentation

friend class OneServerSocket
friend

Definition at line 35 of file ServerSocket.hxx.


The documentation for this class was generated from the following file: