ONPOSIX
2.0
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Enumerator
Friends
Macros
Pages
StreamSocketServerDescriptor.cpp
Go to the documentation of this file.
1
/*
2
* StreamSocketServerDescriptor.cpp
3
*
4
* Copyright (C) 2012 Evidence Srl - www.evidence.eu.com
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
15
*
16
* You should have received a copy of the GNU Library General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#include <stdexcept>
22
#include "
StreamSocketServerDescriptor.hpp
"
23
24
namespace
onposix {
25
26
/**
27
* \brief Constructor to accept() connections on a socket.
28
*
29
* This constructor calls accept().
30
* @param socket StreamSocketServer on which a new connection must be accepted.
31
* @exception runtime_error in case of error in accept()
32
*/
33
StreamSocketServerDescriptor::StreamSocketServerDescriptor
(
const
StreamSocketServer
& socket)
34
{
35
fd_
= accept(socket.
getDescriptorNumber
(), NULL, 0);
36
if
(
fd_
< 0) {
37
ERROR
(
"accept()"
);
38
throw
std::runtime_error(
"Accept error"
);
39
}
40
}
41
42
}
/* onposix */
src
StreamSocketServerDescriptor.cpp
Generated on Wed Apr 30 2014 15:27:24 for ONPOSIX by
1.8.1.2