author | terom |
Tue, 16 Dec 2008 23:21:26 +0000 | |
changeset 380 | d193dd1d8a7e |
parent 378 | 5589abf5e61b |
child 381 | 9b35bc329d23 |
permissions | -rw-r--r-- |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
1 |
#ifndef NETWORK_SOCKET_HH |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
2 |
#define NETWORK_SOCKET_HH |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
3 |
|
380 | 4 |
// forward-declare |
5 |
class NetworkSocket; |
|
6 |
||
186 | 7 |
#include "../Error.hh" |
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
8 |
#include "Address.hh" |
380 | 9 |
#include "Reactor.hh" |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
10 |
|
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
11 |
/* |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
12 |
* Platform-specific includes |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
13 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
14 |
#ifndef WIN32 |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
15 |
// linux |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
16 |
#include <sys/types.h> |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
17 |
#include <sys/socket.h> |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
18 |
#include <unistd.h> |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
19 |
#include <fcntl.h> |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
20 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
21 |
#define closesocket close |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
22 |
#else |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
23 |
#error "This network code won't compile on win32 :)" |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
24 |
#endif |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
25 |
|
284 | 26 |
/** |
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
27 |
* We use ClanLib's Socket API, but with our own extensions... |
284 | 28 |
*/ |
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
29 |
class NetworkSocket { |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
30 |
private: |
380 | 31 |
/** |
32 |
* Socket family/type/protocol |
|
33 |
*/ |
|
34 |
struct socket_type { |
|
35 |
/** Socket domain */ |
|
36 |
int family; |
|
37 |
||
38 |
/** Socket type */ |
|
39 |
int socktype; |
|
40 |
||
41 |
/** Socket protocol */ |
|
42 |
int protocol; |
|
43 |
||
44 |
/** Simple constructor */ |
|
45 |
socket_type (int family = 0, int socktype = 0, int protocol = 0) : family(family), socktype(socktype), protocol(protocol) { } |
|
46 |
}; |
|
47 |
||
48 |
/** These are nonzero if given via the constructor, used to filter out unwanted addrinfos */ |
|
49 |
socket_type sock_type; |
|
50 |
||
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
51 |
/** The file descriptor */ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
52 |
int fd; |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
53 |
|
380 | 54 |
/** Our current type, intialized via constructor, but updated by lazy_socket */ |
55 |
socket_type type; |
|
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
56 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
57 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
58 |
* Has the socket been explicitly bind()'d? If so, force ourselves to use this socket in connect(). |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
59 |
*/ |
380 | 60 |
bool bound : 1; |
61 |
||
62 |
/** |
|
63 |
* Registered to reactor? |
|
64 |
*/ |
|
65 |
bool registered : 1; |
|
66 |
||
67 |
/** |
|
68 |
* Do we want to know about recv()s? |
|
69 |
*/ |
|
70 |
bool want_read : 1; |
|
71 |
||
72 |
/** |
|
73 |
* Is the write buffer full? |
|
74 |
*/ |
|
75 |
bool want_write : 1; |
|
76 |
||
77 |
/** |
|
78 |
* The reactor that we use, defaults to NetworkReactor::current |
|
79 |
*/ |
|
80 |
NetworkReactor *reactor; |
|
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
81 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
82 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
83 |
* Read/write signals |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
84 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
85 |
CL_Signal_v0 _sig_read, _sig_write; |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
86 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
87 |
public: |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
88 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
89 |
* Construct a socket of the specific type. Family and protocol can be left as NULL, but type should usually |
380 | 90 |
* be specified. The given reactor is used for polling, defaults to NetworkReactor::current |
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
91 |
*/ |
380 | 92 |
NetworkSocket (int family, int socktype, int protocol = 0, NetworkReactor *reactor = NULL); |
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
93 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
94 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
95 |
* Create a socket from the given pre-existing fd |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
96 |
*/ |
380 | 97 |
NetworkSocket (int fd, socket_type type, NetworkReactor *reactor = NULL); |
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
98 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
99 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
100 |
* Force-close the socket if it's still open |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
101 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
102 |
~NetworkSocket (void); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
103 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
104 |
private: |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
105 |
// XXX: nocopy |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
106 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
107 |
/** |
380 | 108 |
* Reset bound+poll |
109 |
*/ |
|
110 |
void reset (void); |
|
111 |
||
112 |
/** |
|
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
113 |
* Create a new socket of the given type, unless we already have one |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
114 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
115 |
void lazy_socket (int family, int type, int protocol); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
116 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
117 |
/** |
380 | 118 |
* Close and reset, ignoring errors |
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
119 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
120 |
void force_close (void); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
121 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
122 |
public: |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
123 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
124 |
* Get the socket fd... promise not to break it |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
125 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
126 |
int get_socket (void) const { return fd; } |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
127 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
128 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
129 |
* Bind to a specific local address |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
130 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
131 |
void bind (const NetworkAddress &addr); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
132 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
133 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
134 |
* Put socket into listen mode |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
135 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
136 |
void listen (int backlog); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
137 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
138 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
139 |
* Get local address |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
140 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
141 |
NetworkAddress get_local_address (void); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
142 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
143 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
144 |
* Get remote address |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
145 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
146 |
NetworkAddress get_remote_address (void); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
147 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
148 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
149 |
* Make send/recv/connect non-blocking |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
150 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
151 |
void set_nonblocking (bool nonblocking); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
152 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
153 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
154 |
* Accept a new connection, optionally giving the connection's source address |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
155 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
156 |
NetworkSocket* accept (NetworkAddress *src); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
157 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
158 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
159 |
* Establish a new connection |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
160 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
161 |
void connect (const NetworkAddress &addr); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
162 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
163 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
164 |
* Send, optionally using the specific destination |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
165 |
* |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
166 |
* @return number of bytes sent, zero if busy |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
167 |
* @throw NetworkSocketError on error |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
168 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
169 |
size_t send (const char *buf, size_t size, const NetworkAddress *dest = NULL); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
170 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
171 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
172 |
* Recv, optionally storing the source in src |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
173 |
* |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
174 |
* @return number of bytes received, zero if none available |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
175 |
* @throw NetworkSocketEOFError if the connection was closed |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
176 |
* @throw NetworkSocketError on error |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
177 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
178 |
size_t recv (char *buf, size_t size, NetworkAddress *src = NULL); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
179 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
180 |
/** |
380 | 181 |
* Close and reset the socket |
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
182 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
183 |
void close (void); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
184 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
185 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
186 |
* Triggered when socket becomes readable |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
187 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
188 |
CL_Signal_v0& sig_read (void) { return _sig_read; } |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
189 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
190 |
/** |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
191 |
* Triggered when socket becomes writeable after a send that returned zero |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
192 |
*/ |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
193 |
CL_Signal_v0& sig_write (void) { return _sig_write; } |
380 | 194 |
|
195 |
/** |
|
196 |
* Register to NetworkReactor unless already registered |
|
197 |
*/ |
|
198 |
void register_poll (void); |
|
199 |
||
200 |
/** |
|
201 |
* Trigger sig_read() once socket is ready for recv? |
|
202 |
*/ |
|
203 |
void set_poll_read (bool want_read) { this->want_read = want_read; if (!registered) register_poll(); } |
|
204 |
||
205 |
/** |
|
206 |
* Trigger sig_write() once socket is ready for send? |
|
207 |
*/ |
|
208 |
void set_poll_write (bool want_write) { this->want_write = want_write; if (!registered) register_poll(); } |
|
209 |
||
210 |
/** |
|
211 |
* What events this socket is interested in. |
|
212 |
*/ |
|
213 |
NetworkPollMask get_poll (void) { |
|
214 |
return (want_read ? POLL_READ : 0) | (want_write ? POLL_WRITE : 0); |
|
215 |
} |
|
216 |
||
217 |
/** |
|
218 |
* Notify of events |
|
219 |
*/ |
|
220 |
void notify (NetworkPollMask mask) { |
|
221 |
if (mask & POLL_READ) _sig_read(); |
|
222 |
if (mask & POLL_WRITE) _sig_write(); |
|
223 |
} |
|
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
224 |
}; |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
225 |
|
284 | 226 |
/** |
227 |
* Base class for expcetions thrown by socket methods |
|
228 |
*/ |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
229 |
class NetworkSocketError : public Error { |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
230 |
protected: |
378
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
231 |
static std::string build_str (const NetworkSocket &socket, const char *op, const char *err); |
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
232 |
|
5589abf5e61b
break the network code. Too late to set up a branch for this now
terom
parents:
284
diff
changeset
|
233 |
public: |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
234 |
NetworkSocketError (const NetworkSocket &socket, const char *op, const char *err); |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
235 |
}; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
236 |
|
284 | 237 |
/** |
238 |
* Errno-enabled exception, most common type of NetworkSocketError |
|
239 |
*/ |
|
380 | 240 |
class NetworkSocketErrno : public NetworkSocketError { |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
241 |
public: |
380 | 242 |
NetworkSocketErrno (const NetworkSocket &socket, const char *op); |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
243 |
}; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
244 |
|
284 | 245 |
/** |
246 |
* Recv returned EOF |
|
247 |
*/ |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
248 |
class NetworkSocketEOFError : public NetworkSocketError { |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
249 |
public: |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
250 |
NetworkSocketEOFError (const NetworkSocket &socket, const char *op) : |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
251 |
NetworkSocketError(socket, op, "EOF") { } |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
252 |
}; |
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
253 |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
254 |
#endif /* NETWORK_SOCKET_HH */ |