|
CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
|
Common interface for claw::net::basic_socketbuf and claw::net::socket_server. More...
#include <basic_socket.hpp>
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. | |
Common interface for claw::net::basic_socketbuf and claw::net::socket_server.
Definition at line 46 of file basic_socket.hpp.
| claw::net::basic_socket::basic_socket | ( | ) |
Constructor.
Definition at line 37 of file basic_socket.cpp.
: m_descriptor(socket_traits::invalid_socket) { } // basic_socket::basic_socket()
| claw::net::basic_socket * claw::net::basic_socket::close | ( | ) |
Close the socket.
Reimplemented in claw::net::basic_socketbuf< CharT, Traits >, claw::net::socket_server, and claw::net::basic_socketbuf< char_type, traits_type >.
Definition at line 65 of file basic_socket.cpp.
References claw::socket_traits_unix::close(), and claw::socket_traits_unix::invalid_socket.
Referenced by claw::net::basic_socketbuf< CharT, Traits >::close(), claw::net::socket_server::close(), and claw::net::socket_server::open().
{
basic_socket* result = this;
if ( is_open() )
{
if ( socket_traits::close(m_descriptor) )
m_descriptor = socket_traits::invalid_socket;
else
result = NULL;
}
return result;
} // basic_socket::close()
| bool claw::net::basic_socket::is_open | ( | ) | const |
Tell if the socket is open.
Reimplemented in claw::net::basic_socketbuf< CharT, Traits >, claw::net::socket_server, and claw::net::basic_socketbuf< char_type, traits_type >.
Definition at line 84 of file basic_socket.cpp.
References claw::socket_traits_unix::valid_descriptor().
Referenced by claw::net::basic_socketbuf< CharT, Traits >::is_open(), and claw::net::socket_server::is_open().
{
return socket_traits::valid_descriptor(m_descriptor);
} // basic_socket::is_open()
| claw::net::basic_socket * claw::net::basic_socket::open | ( | ) |
Open the socket.
Definition at line 48 of file basic_socket.cpp.
References claw::socket_traits_unix::open(), and claw::socket_traits_unix::valid_descriptor().
Referenced by claw::net::basic_socketbuf< CharT, Traits >::open(), and claw::net::socket_server::open().
{
basic_socket* result = NULL;
m_descriptor = socket_traits::open();
if ( socket_traits::valid_descriptor( m_descriptor ) )
result = this;
return result;
} // basic_socket::open()
File descriptor.
Definition at line 58 of file basic_socket.hpp.
Referenced by claw::net::socket_server::accept().
1.7.3