Claw
1.7.3
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
code
basic_socket.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@gamned.org
24
*/
30
#include <
claw/basic_socket.hpp
>
31
32
/*----------------------------------------------------------------------------*/
37
claw::net::basic_socket::basic_socket
()
38
: m_descriptor(
socket_traits
::invalid_socket)
39
{
40
41
}
// basic_socket::basic_socket()
42
43
/*----------------------------------------------------------------------------*/
48
claw::net::basic_socket
*
claw::net::basic_socket::open
()
49
{
50
basic_socket
* result = NULL;
51
52
m_descriptor =
socket_traits::open
();
53
54
if
(
socket_traits::valid_descriptor
( m_descriptor ) )
55
result =
this
;
56
57
return
result;
58
}
// basic_socket::open()
59
60
/*----------------------------------------------------------------------------*/
65
claw::net::basic_socket
*
claw::net::basic_socket::close
()
66
{
67
basic_socket
* result =
this
;
68
69
if
( is_open() )
70
{
71
if
(
socket_traits::close
(m_descriptor) )
72
m_descriptor =
socket_traits::invalid_socket
;
73
else
74
result = NULL;
75
}
76
77
return
result;
78
}
// basic_socket::close()
79
80
/*----------------------------------------------------------------------------*/
84
bool
claw::net::basic_socket::is_open
()
const
85
{
86
return
socket_traits::valid_descriptor
(m_descriptor);
87
}
// basic_socket::is_open()
88
Generated on Thu Mar 14 2013 22:09:24 for Claw by
1.8.1.2