claw
1.9.0
Toggle main menu visibility
Loading...
Searching...
No Matches
socket_server.cpp
Go to the documentation of this file.
1
/*
2
CLAW - a C++ Library Absolutely Wonderful
3
4
CLAW is a free library without any particular aim but being useful to
5
anyone.
6
7
Copyright (C) 2005-2011 Julien Jorge
8
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Lesser General Public
11
License as published by the Free Software Foundation; either
12
version 2.1 of the License, or (at your option) any later version.
13
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Lesser General Public License for more details.
18
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
23
contact: julien.jorge@stuff-o-matic.com
24
*/
30
#include <
claw/net/socket_server.hpp
>
31
32
#include <sys/types.h>
33
38
claw::net::socket_server::socket_server
()
39
{
40
// nothing to do
41
}
42
48
claw::net::socket_server::socket_server
(
int
port,
unsigned
int
queue_size)
49
{
50
open
(port, queue_size);
51
}
52
59
claw::net::socket_server
*
60
claw::net::socket_server::open
(
int
port,
unsigned
int
queue_size)
61
{
62
socket_server
* result = NULL;
63
64
if
(
basic_socket::open
())
65
{
66
if
(!
socket_traits::listen
(
m_descriptor
, port, queue_size))
67
basic_socket::close
();
68
else
69
result =
this
;
70
}
71
72
return
result;
73
}
74
78
claw::net::socket_server
*
claw::net::socket_server::close
()
79
{
80
if
(
basic_socket::close
())
81
return
this
;
82
else
83
return
NULL;
84
}
85
89
bool
claw::net::socket_server::is_open
()
const
90
{
91
return
basic_socket::is_open
();
92
}
93
97
claw::net::socket_server::operator bool()
const
98
{
99
return
is_open
();
100
}
101
106
bool
claw::net::socket_server::init
()
107
{
108
return
socket_traits::init
();
109
}
110
115
bool
claw::net::socket_server::release
()
116
{
117
return
socket_traits::release
();
118
}
claw::net::basic_socket::open
basic_socket * open()
Open the socket.
Definition
basic_socket.cpp:44
claw::net::basic_socket::close
basic_socket * close()
Close the socket.
Definition
basic_socket.cpp:60
claw::net::basic_socket::is_open
bool is_open() const
Tell if the socket is open.
Definition
basic_socket.cpp:78
claw::net::basic_socket::m_descriptor
socket_traits::descriptor m_descriptor
File descriptor.
Definition
basic_socket.hpp:59
claw::net::socket_server
Class used to receive incoming connections.
Definition
socket_server.hpp:49
claw::net::socket_server::release
static bool release()
Close the socket library.
Definition
socket_server.cpp:115
claw::net::socket_server::init
static bool init()
Initialize the use of the socket library.
Definition
socket_server.cpp:106
claw::net::socket_server::socket_server
socket_server()
Constructor.
Definition
socket_server.cpp:38
claw::net::socket_server::close
socket_server * close()
Close the socket.
Definition
socket_server.cpp:78
claw::net::socket_server::open
socket_server * open(int port, unsigned int queue_size=s_default_queue_size)
Open the socket.
Definition
socket_server.cpp:60
claw::net::socket_server::is_open
bool is_open() const
Tell if the server is open.
Definition
socket_server.cpp:89
claw::socket_traits_unix::listen
static bool listen(descriptor d, int port, unsigned int queue_size)
Open a socket for incoming connexions.
Definition
socket_traits_unix.hpp:139
claw::socket_traits_unix::release
static bool release()
Close the socket library.
Definition
socket_traits_unix.hpp:74
claw::socket_traits_unix::init
static bool init()
Initialize the use of the socket library.
Definition
socket_traits_unix.hpp:65
socket_server.hpp
Class used to receive incoming connections.
lib
net
src
claw
net
socket_server.cpp
Generated by
1.17.0