MPD 0.20.6

- Main Page
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

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 ()
EventLoop & | GetEventLoop ()
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

  hostname | the host name to be resolved
  port | the TCP port
  error | location 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

  path | the absolute socket path
  error | location 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

  port | the TCP port
  error | location 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
| ) |  |
| protected pure 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:

- event/ServerSocket.hxx