claw::net::basic_socket Class Reference

Common interface for claw::net::basic_socketbuf and claw::net::socket_server. More...

`#include <basic_socket.hpp>`

Inheritance diagram for claw::net::basic_socket:

## Public Member Functions

| basic_socket ()
| Constructor.
basic_socket * | open ()
| Open the socket.
basic_socket * | close ()
| Close the socket.
bool | is_open () const
| Tell if the socket is open.

## Protected Attributes

socket_traits::descriptor | m_descriptor
| File descriptor.

## Detailed Description

Common interface for claw::net::basic_socketbuf and claw::net::socket_server.

Author
  Julien Jorge

Definition at line 46 of file basic_socket.hpp.

## Constructor & Destructor Documentation

## basic_socket()

claw::net::basic_socket::basic_socket | ( |  | ) |

Constructor.

Postcondition
  is_open() == false

Definition at line 37 of file basic_socket.cpp.

References m_descriptor.

Referenced by close(), and open().

## Member Function Documentation

## close()

claw::net::basic_socket * claw::net::basic_socket::close | ( |  | ) |

Close the socket.

Returns
  this if everything works fine, NULL otherwise.

Definition at line 65 of file basic_socket.cpp.

References basic_socket(), claw::socket_traits_unix::close(), claw::socket_traits_unix::invalid_socket, is_open(), and m_descriptor.

Referenced by claw::net::socket_server::close(), and claw::net::socket_server::open().

## is_open()

bool claw::net::basic_socket::is_open | ( |  | ) | const

Tell if the socket is open.

Definition at line 84 of file basic_socket.cpp.

References m_descriptor, and claw::socket_traits_unix::valid_descriptor().

Referenced by close(), and claw::net::socket_server::is_open().

## open()

claw::net::basic_socket * claw::net::basic_socket::open | ( |  | ) |

Open the socket.

Returns
  this is everything works fine, NULL otherwise.

Definition at line 48 of file basic_socket.cpp.

References basic_socket(), m_descriptor, claw::socket_traits_unix::open(), and claw::socket_traits_unix::valid_descriptor().

Referenced by claw::net::socket_server::open().

## Member Data Documentation

## m_descriptor

socket_traits::descriptor claw::net::basic_socket::m_descriptor

protected

File descriptor.

Definition at line 58 of file basic_socket.hpp.

Referenced by basic_socket(), close(), is_open(), open(), and claw::net::socket_server::open().

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

- basic_socket.hpp
- code/basic_socket.cpp