Kyoto Tycoon

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
kyototycoon::ServerSocket Class Reference

Network server abstraction based on TCP/IP. More...

`#include <ktsocket.h>`

List of all members.

## Public Member Functions

| ServerSocket ()
| Default constructor.
| ~ServerSocket ()
| Destructor.
const char * | error ()
| Get the last happened error information.
bool | open (const std::string &expr)
| Open a server socket.
bool | close ()
| Close the socket.
bool | accept (Socket *sock)
| Accept a connection from a client.
bool | abort ()
| Abort the current operation.
bool | set_timeout (double timeout)
| Set the timeout of each operation.
const std::string | expression ()
| Get the expression of the socket.
int32_t | descriptor ()
| Get the descriptor integer.
void | set_event_flags (uint32_t flags)
| Set event flags.
uint32_t | event_flags ()
| Get the current event flags.

## Detailed Description

Network server abstraction based on TCP/IP.

## Constructor & Destructor Documentation

kyototycoon::ServerSocket::ServerSocket | ( |  | ) | `[explicit]`

Default constructor.

kyototycoon::ServerSocket::~ServerSocket | ( |  | ) |

Destructor.

## Member Function Documentation

const char* kyototycoon::ServerSocket::error | ( |  | ) |

Get the last happened error information.

Returns:
  the last happened error information.

bool kyototycoon::ServerSocket::open | ( | const std::string & | expr | ) |

Open a server socket.

Parameters:

  expr | an expression of the address and the port of the server.

Returns:
  true on success, or false on failure.

bool kyototycoon::ServerSocket::close | ( |  | ) |

Close the socket.

Returns:
  true on success, or false on failure.

bool kyototycoon::ServerSocket::accept | ( | Socket * | sock | ) |

Accept a connection from a client.

Parameters:

  sock | the socket object to manage the connection.

Returns:
  true on success, or false on failure.

bool kyototycoon::ServerSocket::abort | ( |  | ) |

Abort the current operation.

Returns:
  true on success, or false on failure.

bool kyototycoon::ServerSocket::set_timeout | ( | double | timeout | ) |

Set the timeout of each operation.

Parameters:

  timeout | the timeout of each operation in seconds.

Returns:
  true on success, or false on failure.

const std::string kyototycoon::ServerSocket::expression | ( |  | ) |

Get the expression of the socket.

Returns:
  the expression of the socket or an empty string on failure.

int32_t kyototycoon::ServerSocket::descriptor | ( |  | ) | `[virtual]`

Get the descriptor integer.

Returns:
  the descriptor integer, or -1 on failure.

Implements kyototycoon::Pollable.

void kyototycoon::ServerSocket::set_event_flags | ( | uint32_t | flags | ) | `[virtual]`

Set event flags.

Parameters:

  flags | specifies the event mode. The following may be added by bitwise-or: ServerSocket::EVINPUT for input events, ServerSocket::EVOUTPUT for output events, ServerSocket::EVERROR for error events.

Implements kyototycoon::Pollable.

uint32_t kyototycoon::ServerSocket::event_flags | ( |  | ) | `[virtual]`

Get the current event flags.

Returns:
  the current event flags.

Implements kyototycoon::Pollable.