NetSocket++
0.1
A library designed to simplify working with UNIX sockets in C++, written in OOP methodology.
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
ServerSocket.h
Go to the documentation of this file.
1
#ifndef _SERVERSOCKET_H
2
#define _SERVERSOCKET_H
3
#include "
NetSocket.h
"
4
#include "
NetworkException.h
"
5
#include "
SocketException.h
"
11
15
inline
void
sigchld_handler
(
int
s) {
16
while
(waitpid(-1, NULL, WNOHANG) > 0);
17
}
18
21
namespace
NetSocketPP {
24
class
ServerFunctionArgs
{
25
private
:
26
std::string* _tab;
27
unsigned
int
_size;
28
public
:
29
ServerFunctionArgs
();
30
ServerFunctionArgs
(
ServerFunctionArgs
& sfa);
31
32
~ServerFunctionArgs
();
33
void
addArgument
(std::string arg);
34
35
std::string
getArgument
(
unsigned
int
idx);
36
37
38
std::string
operator[]
(
unsigned
int
idx);
39
40
41
};
44
class
ServerSocket
:
public
NetSocket
{
45
private
:
46
int
_newDescriptor;
47
char
_buf[100000];
48
struct
sigaction _sa;
49
public
:
50
ServerSocket
(std::string host, std::string service, std::string protocol);
51
52
53
54
~ServerSocket
();
55
void
startServer
(
ServerFunctionArgs
& functionOutput ,
ServerFunctionArgs
& (*serverMain)(
ServerFunctionArgs
,
ServerSocket
*),
ServerFunctionArgs
functionInput,
bool
infinite,
unsigned
int
iternum,
int
connectionLimit);
56
57
58
59
60
61
62
int
send
(std::string msg,
int
flags=0);
63
64
65
66
int
recv
(
int
flags = 0);
67
68
69
std::string
get
();
70
71
};
72
}
73
#endif
Generated on Wed Feb 27 2013 00:04:34 for NetSocket++ by
1.8.3.1