Async
0.18.0
Main Page
Namespaces
Classes
Files
Examples
File List
File Members
include
AsyncTcpServer.h
Go to the documentation of this file.
1
34
#ifndef ASYNC_TCP_SERVER_INCLUDED
35
#define ASYNC_TCP_SERVER_INCLUDED
36
37
38
/****************************************************************************
39
*
40
* System Includes
41
*
42
****************************************************************************/
43
44
#include <string>
45
#include <vector>
46
#include <sigc++/sigc++.h>
47
48
49
/****************************************************************************
50
*
51
* Project Includes
52
*
53
****************************************************************************/
54
55
#include <
AsyncTcpConnection.h
>
56
57
58
/****************************************************************************
59
*
60
* Local Includes
61
*
62
****************************************************************************/
63
64
65
66
/****************************************************************************
67
*
68
* Forward declarations
69
*
70
****************************************************************************/
71
72
73
74
/****************************************************************************
75
*
76
* Namespace
77
*
78
****************************************************************************/
79
80
namespace
Async
81
{
82
83
/****************************************************************************
84
*
85
* Forward declarations of classes inside of the declared namespace
86
*
87
****************************************************************************/
88
89
class
FdWatch;
90
91
92
/****************************************************************************
93
*
94
* Defines & typedefs
95
*
96
****************************************************************************/
97
98
99
100
/****************************************************************************
101
*
102
* Exported Global Variables
103
*
104
****************************************************************************/
105
106
107
108
/****************************************************************************
109
*
110
* Class definitions
111
*
112
****************************************************************************/
113
126
class
TcpServer
:
public
SigC::Object
127
{
128
public
:
133
TcpServer
(
const
std::string& port_str);
134
138
~TcpServer
(
void
);
139
144
int
numberOfClients
(
void
);
145
151
TcpConnection
*
getClient
(
unsigned
int
index);
152
159
int
writeAll
(
const
void
*buf,
int
count);
160
168
int
writeOnly
(
TcpConnection
*con,
const
void
*buf,
int
count);
169
177
int
writeExcept
(
TcpConnection
*con,
const
void
*buf,
int
count);
178
183
SigC::Signal1<void, TcpConnection *>
clientConnected
;
184
190
SigC::Signal2<void, TcpConnection *,TcpConnection::DisconnectReason>
191
clientDisconnected
;
192
193
194
protected
:
195
196
private
:
197
typedef
std::vector<TcpConnection*> TcpConnectionList;
198
199
int
sock;
200
FdWatch
*rd_watch;
201
TcpConnectionList tcpConnectionList;
202
203
void
cleanup(
void
);
204
void
onConnection(
FdWatch
*watch);
205
void
onDisconnected(
TcpConnection
*con,
206
TcpConnection::DisconnectReason
reason);
207
208
};
/* class TcpServer */
209
210
211
}
/* namespace */
212
213
#endif
/* ASYNC_TCP_SERVER_INCLUDED */
214
215
216
217
/*
218
* This file has not been truncated
219
*/
220
221
222
Generated by
1.8.3.1