]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxSocketBase}}\label{wxsocketbase} | |
2 | ||
3 | \wxheading{Derived from} | |
4 | ||
5 | \helpref{wxEvtHandler}{wxevthandler} | |
6 | ||
7 | % --------------------------------------------------------------------------- | |
8 | % Event handling | |
9 | % --------------------------------------------------------------------------- | |
10 | \wxheading{Event handling} | |
11 | ||
12 | To process events from a socket, use the following event handler macro to direct | |
13 | input to member | |
14 | functions that take a \helpref{wxSocketEvent}{wxsocketevent} argument. | |
15 | ||
16 | \twocolwidtha{7cm}% | |
17 | \begin{twocollist}\itemsep=0pt | |
18 | \twocolitem{{\bf EVT\_SOCKET(id, func)}}{A socket event occured.} | |
19 | \end{twocollist}% | |
20 | ||
21 | % --------------------------------------------------------------------------- | |
22 | % See also ... | |
23 | % --------------------------------------------------------------------------- | |
24 | \wxheading{See also} | |
25 | ||
26 | \helpref{wxSocketEvent}{wxsocketevent}, \helpref{wxSocketClient}{wxsocketclient}, \helpref{wxSocketServer}{wxsocketserver} | |
27 | ||
28 | % --------------------------------------------------------------------------- | |
29 | % Members | |
30 | % --------------------------------------------------------------------------- | |
31 | \latexignore{\rtfignore{\wxheading{Members}}} | |
32 | ||
33 | \membersection{wxSocketBase::wxSocketBase} | |
34 | ||
35 | \func{}{wxSocketBase}{\void} | |
36 | ||
37 | Default constructor but don't use it, you must use \helpref{wxSocketClient}{wxsocketclient} | |
38 | or \helpref{wxSocketServer}{wxsocketserver}. | |
39 | ||
40 | \membersection{wxSocketBase::\destruct{wxSocketBase}} | |
41 | ||
42 | \func{}{\destruct{wxSocketBase}}{\void} | |
43 | ||
44 | Destroys the wxSocketBase object. | |
45 | ||
46 | % --------------------------------------------------------------------------- | |
47 | % State functions | |
48 | % --------------------------------------------------------------------------- | |
49 | ||
50 | \membersection{wxSocketBase::Ok}\label{wxsocketbaseok} | |
51 | ||
52 | \constfunc{bool}{Ok}{\void} | |
53 | ||
54 | Returns TRUE if the socket is initialized and ready and FALSE in other | |
55 | cases. | |
56 | ||
57 | \membersection{wxSocketBase::Error}\label{wxsocketbaseerror} | |
58 | ||
59 | \constfunc{bool}{Error}{\void} | |
60 | ||
61 | Returns TRUE if an error occured. | |
62 | ||
63 | \membersection{wxSocketBase::IsConnected}\label{wxsocketbaseconnected} | |
64 | ||
65 | \constfunc{bool}{IsConnected}{\void} | |
66 | ||
67 | Returns TRUE if the socket is connected. | |
68 | ||
69 | \membersection{wxSocketBase::IsData}\label{wxsocketbaseisdata} | |
70 | ||
71 | \constfunc{bool}{IsData}{\void} | |
72 | ||
73 | Returns TRUE if some data is arrived on the socket. | |
74 | ||
75 | \membersection{wxSocketBase::IsDisconnected}\label{wxsocketbasedisconnected} | |
76 | ||
77 | \constfunc{bool}{IsDisconnected}{\void} | |
78 | ||
79 | Returns TRUE if the socket is disconnected. | |
80 | ||
81 | \membersection{wxSocketBase::IsNoWait}\label{wxsocketbasenowait} | |
82 | ||
83 | \constfunc{bool}{IsNoWait}{\void} | |
84 | ||
85 | Returns TRUE if the socket mustn't wait. | |
86 | ||
87 | \membersection{wxSocketBase::LastCount}\label{wxsocketbaselastcount} | |
88 | ||
89 | \constfunc{size\_t}{LastCount}{\void} | |
90 | ||
91 | Returns the number of bytes read or written by the last IO call. | |
92 | ||
93 | \membersection{wxSocketBase::LastError}\label{wxsocketbaselasterror} | |
94 | ||
95 | \constfunc{int}{LastError}{\void} | |
96 | ||
97 | Returns an error in the errno format (see your C programmer's guide). | |
98 | ||
99 | % --------------------------------------------------------------------------- | |
100 | % IO calls | |
101 | % --------------------------------------------------------------------------- | |
102 | % | |
103 | % Peek | |
104 | % | |
105 | \membersection{wxSocketBase::Peek}\label{wxsocketbasepeek} | |
106 | ||
107 | \func{wxSocketBase\&}{Peek}{\param{char *}{ buffer}, \param{size\_t}{ nbytes}} | |
108 | ||
109 | This function peeks a buffer of {\it nbytes} bytes from the socket. Peeking a buffer | |
110 | doesn't delete it from the system socket in-queue. | |
111 | ||
112 | \wxheading{Parameters} | |
113 | ||
114 | \docparam{buffer}{Buffer where to put peeked data.} | |
115 | ||
116 | \docparam{nbytes}{Number of bytes.} | |
117 | ||
118 | \wxheading{Return value} | |
119 | ||
120 | Returns a reference to the current object. | |
121 | ||
122 | \wxheading{See also} | |
123 | ||
124 | \helpref{wxSocketBase::Error}{wxsocketbaseerror}, | |
125 | \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount}, | |
126 | \helpref{wxSocketBase::LastError}{wxsocketbaselasterror} | |
127 | ||
128 | % | |
129 | % Read | |
130 | % | |
131 | \membersection{wxSocketBase::Read}\label{wxsocketbaseread} | |
132 | ||
133 | \func{wxSocketBase\&}{Read}{\param{char *}{ buffer}, \param{size\_t}{ nbytes}} | |
134 | ||
135 | This function reads a buffer of {\it nbytes} bytes from the socket. | |
136 | ||
137 | \wxheading{Parameters} | |
138 | ||
139 | \docparam{buffer}{Buffer where to put read data.} | |
140 | ||
141 | \docparam{nbytes}{Number of bytes.} | |
142 | ||
143 | \wxheading{Return value} | |
144 | ||
145 | Returns a reference to the current object. | |
146 | ||
147 | \wxheading{See also} | |
148 | ||
149 | \helpref{wxSocketBase::Error}{wxsocketbaseerror}, | |
150 | \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount}, | |
151 | \helpref{wxSocketBase::LastError}{wxsocketbaselasterror} | |
152 | ||
153 | \membersection{wxSocketBase::SetFlags}\label{wxsocketbasesetflags} | |
154 | ||
155 | \func{void}{SetFlags}{\param{wxSockFlags}{ flags}} | |
156 | ||
157 | TODO | |
158 | ||
159 | % | |
160 | % Read | |
161 | % | |
162 | \membersection{wxSocketBase::Write}\label{wxsocketbasewrite} | |
163 | ||
164 | \func{wxSocketBase\&}{Write}{\param{const char *}{ buffer}, \param{size\_t}{ nbytes}} | |
165 | ||
166 | This function writes a buffer of {\it nbytes} bytes from the socket. | |
167 | ||
168 | \wxheading{Parameters} | |
169 | ||
170 | \docparam{buffer}{Buffer where to get the data to write.} | |
171 | ||
172 | \docparam{nbytes}{Number of bytes.} | |
173 | ||
174 | \wxheading{Return value} | |
175 | ||
176 | Returns a reference to the current object. | |
177 | ||
178 | \wxheading{See also} | |
179 | ||
180 | \helpref{wxSocketBase::Error}{wxsocketbaseerror}, | |
181 | \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount}, | |
182 | \helpref{wxSocketBase::LastError}{wxsocketbaselasterror} | |
183 | ||
184 | % | |
185 | % WriteMsg | |
186 | % | |
187 | \membersection{wxSocketBase::WriteMsg}\label{wxsocketbasewritemsg} | |
188 | ||
189 | \func{wxSocketBase\&}{WriteMsg}{\param{const char *}{ buffer}, \param{size\_t}{ nbytes}} | |
190 | ||
191 | This function writes a buffer of {\it nbytes} bytes from the socket. But it | |
192 | writes a short header before so that ReadMsg can alloc the right size for | |
193 | the buffer. So a buffer sent with WriteMsg {\bf must} be read with ReadMsg. | |
194 | ||
195 | \wxheading{Parameters} | |
196 | ||
197 | \docparam{buffer}{Buffer where to put data peeked.} | |
198 | ||
199 | \docparam{nbytes}{Number of bytes.} | |
200 | ||
201 | \wxheading{Return value} | |
202 | ||
203 | Returns a reference to the current object. | |
204 | ||
205 | \wxheading{See also} | |
206 | ||
207 | \helpref{wxSocketBase::Error}{wxsocketbaseerror}, | |
208 | \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount}, | |
209 | \helpref{wxSocketBase::LastError}{wxsocketbaselasterror}, | |
210 | \helpref{wxSocketBase::ReadMsg}{wxsocketbasereadmsg} | |
211 | ||
212 | % | |
213 | % ReadMsg | |
214 | % | |
215 | \membersection{wxSocketBase::ReadMsg}\label{wxsocketbasereadmsg} | |
216 | ||
217 | \func{wxSocketBase\&}{ReadMsg}{\param{char *}{ buffer}, \param{size\_t}{ nbytes}} | |
218 | ||
219 | This function reads a buffer sent by WriteMsg on a socket. If the buffer passed | |
220 | to the function isn't big enough, the function filled it and then discard the | |
221 | bytes left. This function always wait for the buffer to be entirely filled. | |
222 | ||
223 | \wxheading{Parameters} | |
224 | ||
225 | \docparam{buffer}{Buffer where to put read data.} | |
226 | ||
227 | \docparam{nbytes}{Number of bytes allocated for the buffer.} | |
228 | ||
229 | \wxheading{Return value} | |
230 | ||
231 | Returns a reference to the current object. | |
232 | ||
233 | \wxheading{See also} | |
234 | ||
235 | \helpref{wxSocketBase::Error}{wxsocketbaseerror}, | |
236 | \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount}, | |
237 | \helpref{wxSocketBase::LastError}{wxsocketbaselasterror}, | |
238 | \helpref{wxSocketBase::WriteMsg}{wxsocketbasewritemsg} | |
239 | ||
240 | % | |
241 | % Unread | |
242 | % | |
243 | \membersection{wxSocketBase::UnRead}\label{wxsocketbaseunread} | |
244 | ||
245 | \func{wxSocketBase\&}{UnRead}{\param{const char *}{ buffer}, \param{size\_t}{ nbytes}} | |
246 | ||
247 | This function unreads a buffer. It means that the buffer is put in the top | |
248 | of the incoming queue. But, it is put also at the end of all unread buffers. | |
249 | It is useful for sockets because we can't seek it. | |
250 | ||
251 | \wxheading{Parameters} | |
252 | ||
253 | \docparam{buffer}{Buffer to be unread.} | |
254 | ||
255 | \docparam{nbytes}{Number of bytes.} | |
256 | ||
257 | \wxheading{Return value} | |
258 | ||
259 | Returns a reference to the current object. | |
260 | ||
261 | \wxheading{See also} | |
262 | ||
263 | \helpref{wxSocketBase::Error}{wxsocketbaseerror}, | |
264 | \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount}, | |
265 | \helpref{wxSocketBase::LastError}{wxsocketbaselasterror} | |
266 | ||
267 | % | |
268 | % Discard | |
269 | % | |
270 | \membersection{wxSocketBase::Discard}\label{wxsocketbasediscard} | |
271 | ||
272 | \func{wxSocketBase\&}{Discard}{\void} | |
273 | ||
274 | This function simply deletes all bytes in the incoming queue. This function | |
275 | doesn't wait. | |
276 | ||
277 | % --------------------------------------------------------------------------- | |
278 | % Wait functions | |
279 | % --------------------------------------------------------------------------- | |
280 | \membersection{wxSocketBase::Wait}\label{wxsocketbasewait} | |
281 | ||
282 | \func{bool}{Wait}{\param{long}{ seconds = -1}, \param{long}{ microsecond = 0}} | |
283 | ||
284 | This function waits for an event: it could be an incoming byte, the possibility | |
285 | for the client to write, a lost connection, an incoming connection, an | |
286 | established connection. | |
287 | ||
288 | \wxheading{Parameters} | |
289 | ||
290 | \docparam{seconds}{Number of seconds to wait. By default, it waits infinitely.} | |
291 | ||
292 | \docparam{microsecond}{Number of microseconds to wait.} | |
293 | ||
294 | \wxheading{Return value} | |
295 | ||
296 | Returns TRUE if an event occured, FALSE if the timeout was reached. | |
297 | ||
298 | \wxheading{See also} | |
299 | ||
300 | \helpref{wxSocketBase::WaitForRead}{wxsocketbasewaitforread}, | |
301 | \helpref{wxSocketBase::WaitForWrite}{wxsocketbasewaitforwrite}, | |
302 | \helpref{wxSocketBase::WaitForLost}{wxsocketbasewaitforlost} | |
303 | ||
304 | % | |
305 | % WaitForRead | |
306 | % | |
307 | \membersection{wxSocketBase::WaitForRead}\label{wxsocketbasewaitforread} | |
308 | ||
309 | \func{bool}{WaitForRead}{\param{long}{ seconds = -1}, \param{long}{ microsecond = 0}} | |
310 | ||
311 | This function waits for a read event. | |
312 | ||
313 | \wxheading{Parameters} | |
314 | ||
315 | \docparam{seconds}{Number of seconds to wait. By default, it waits infinitely.} | |
316 | ||
317 | \docparam{microsecond}{Number of microseconds to wait.} | |
318 | ||
319 | \wxheading{Return value} | |
320 | ||
321 | Returns TRUE if a byte arrived, FALSE if the timeout was reached. | |
322 | ||
323 | \wxheading{See also} | |
324 | ||
325 | \helpref{wxSocketBase::Wait}{wxsocketbasewait}, | |
326 | \helpref{wxSocketBase::WaitForWrite}{wxsocketbasewaitforwrite}, | |
327 | \helpref{wxSocketBase::WaitForLost}{wxsocketbasewaitforlost} | |
328 | ||
329 | % | |
330 | % WaitForWrite | |
331 | % | |
332 | \membersection{wxSocketBase::WaitForWrite}\label{wxsocketbasewaitforwrite} | |
333 | ||
334 | \func{bool}{WaitForWrite}{\param{long}{ seconds = -1}, \param{long}{ microsecond = 0}} | |
335 | ||
336 | This function waits for a write event. | |
337 | ||
338 | \wxheading{Parameters} | |
339 | ||
340 | \docparam{seconds}{Number of seconds to wait. By default, it waits infinitely.} | |
341 | ||
342 | \docparam{microsecond}{Number of microseconds to wait.} | |
343 | ||
344 | \wxheading{Return value} | |
345 | ||
346 | Returns TRUE if a write event occured, FALSE if the timeout was reached. | |
347 | ||
348 | \wxheading{See also} | |
349 | ||
350 | \helpref{wxSocketBase::Wait}{wxsocketbasewait}, | |
351 | \helpref{wxSocketBase::WaitForRead}{wxsocketbasewaitforread}, | |
352 | \helpref{wxSocketBase::WaitForLost}{wxsocketbasewaitforlost} | |
353 | ||
354 | % | |
355 | % WaitForLost | |
356 | % | |
357 | \membersection{wxSocketBase::WaitForLost}\label{wxsocketbasewaitforlost} | |
358 | ||
359 | \func{bool}{Wait}{\param{long}{ seconds = -1}, \param{long}{ microsecond = 0}} | |
360 | ||
361 | This function waits for a "lost" event. For instance, the peer may have closed | |
362 | the connection, or the connection may have been broken. | |
363 | ||
364 | \wxheading{Parameters} | |
365 | ||
366 | \docparam{seconds}{Number of seconds to wait. By default, it waits infinitely.} | |
367 | ||
368 | \docparam{microsecond}{Number of microseconds to wait.} | |
369 | ||
370 | \wxheading{Return value} | |
371 | ||
372 | Returns TRUE if a "lost" event occured, FALSE if the timeout was reached. | |
373 | ||
374 | \wxheading{See also} | |
375 | ||
376 | \helpref{wxSocketBase::WaitForRead}{wxsocketbasewaitforread}, | |
377 | \helpref{wxSocketBase::WaitForWrite}{wxsocketbasewaitforwrite}, | |
378 | \helpref{wxSocketBase::WaitForLost}{wxsocketbasewaitforlost} | |
379 | ||
380 | % | |
381 | % RestoreState | |
382 | % | |
383 | \membersection{wxSocketBase::RestoreState}\label{wxsocketbaserestorestate} | |
384 | ||
385 | \func{void}{RestoreState}{\void} | |
386 | ||
387 | This function restores a previously saved state. | |
388 | ||
389 | \wxheading{See also} | |
390 | ||
391 | \helpref{wxSocketBase::SaveState}{wxsocketbasesavestate} | |
392 | ||
393 | % --------------------------------------------------------------------------- | |
394 | % Socket state | |
395 | % --------------------------------------------------------------------------- | |
396 | % | |
397 | % SaveState | |
398 | % | |
399 | \membersection{wxSocketBase::SaveState}\label{wxsocketbasesavestate} | |
400 | ||
401 | \func{void}{SaveState}{\void} | |
402 | ||
403 | This function saves the current state of the socket object in a stack: | |
404 | actually it saves all flags and the state of the asynchronous callbacks. | |
405 | ||
406 | \wxheading{See also} | |
407 | ||
408 | \helpref{wxSocketBase::RestoreState}{wxsocketbaserestorestate} | |
409 | ||
410 | % --------------------------------------------------------------------------- | |
411 | % Socket callbacks | |
412 | % --------------------------------------------------------------------------- | |
413 | \membersection{wxSocketBase::SetEventHandler}\label{wxsocketbaseseteventhandler} | |
414 | ||
415 | \func{void}{SetEventHandler}{\param{wxEvtHandler\&}{ evt\_hdlr}, \param{int}{ id = -1}} | |
416 | ||
417 | Sets an event handler to be called when a socket event occured. | |
418 | ||
419 | \wxheading{Parameters} | |
420 | ||
421 | \docparam{evt\_hdlr}{Specifies the event handler you want to use.} | |
422 | ||
423 | \docparam{id}{The id of socket event.} | |
424 | ||
425 | \wxheading{See also} | |
426 | ||
427 | \helpref{wxSocketEvent}{wxsocketevent} | |
428 | ||
429 | % --------------------------------------------------------------------------- | |
430 | % CLASS wxSocketClient | |
431 | % --------------------------------------------------------------------------- | |
432 | \section{\class{wxSocketClient}}\label{wxsocketclient} | |
433 | ||
434 | \wxheading{Derived from} | |
435 | ||
436 | \helpref{wxSocketBase}{wxsocketbase} | |
437 | ||
438 | % --------------------------------------------------------------------------- | |
439 | % Members | |
440 | % --------------------------------------------------------------------------- | |
441 | % | |
442 | % wxSocketClient | |
443 | % | |
444 | \membersection{wxSocketClient::wxSocketClient} | |
445 | ||
446 | \func{}{wxSocketClient}{\param{wxSockFlags}{ flags = wxSocketBase::NONE}} | |
447 | ||
448 | Constructs a new wxSocketClient. | |
449 | ||
450 | {\bf Warning !} The created socket client needs to be registered to a socket handler (See \helpref{wxSocketHandler}{wxsockethandler}). | |
451 | ||
452 | \wxheading{Parameters} | |
453 | ||
454 | \docparam{flags}{Socket flags (See \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags})} | |
455 | ||
456 | % | |
457 | % ~wxSocketClient | |
458 | % | |
459 | \membersection{wxSocketClient::\destruct{wxSocketClient}} | |
460 | ||
461 | \func{}{\destruct{wxSocketClient}}{\void} | |
462 | ||
463 | Destructs a wxSocketClient object. | |
464 | ||
465 | % | |
466 | % Connect | |
467 | % | |
468 | \membersection{wxSocketClient::Connect}\label{wxsocketclientconnect} | |
469 | ||
470 | \func{bool}{Connect}{\param{wxSockAddress\&}{ address}, \param{bool}{ wait = TRUE}} | |
471 | ||
472 | Connects to a server using the specified address. If {\it wait} is TRUE, Connect | |
473 | will wait for the socket ready to send or receive data. | |
474 | ||
475 | \wxheading{Parameters} | |
476 | ||
477 | \docparam{address}{Address of the server.} | |
478 | ||
479 | \docparam{wait}{If true, waits for the connection to be ready.} | |
480 | ||
481 | \wxheading{Return value} | |
482 | ||
483 | Returns TRUE if the connection is established and no error occurs. | |
484 | ||
485 | \wxheading{See also} | |
486 | ||
487 | \helpref{wxSocketClient::WaitOnConnect}{wxsocketclientwaitonconnect} | |
488 | ||
489 | % | |
490 | % WaitOnConnect | |
491 | % | |
492 | \membersection{wxSocketClient::WaitOnConnect}\label{wxsocketclientwaitonconnect} | |
493 | ||
494 | \func{bool}{WaitOnConnect}{\param{long}{ seconds = -1}, \param{long}{ microseconds = 0}} | |
495 | ||
496 | Wait for a "connect" event. | |
497 | ||
498 | \wxheading{See also} | |
499 | ||
500 | \helpref{wxSocketBase::Wait}{wxsocketbasewait} for a detailed description. | |
501 | ||
502 | % --------------------------------------------------------------------------- | |
503 | % CLASS: wxSocketEvent | |
504 | % --------------------------------------------------------------------------- | |
505 | \section{\class{wxSocketEvent}}\label{wxsocketevent} | |
506 | ||
507 | This event class contains information about socket events. | |
508 | ||
509 | \wxheading{Derived from} | |
510 | ||
511 | \helpref{wxEvent}{wxevent} | |
512 | ||
513 | \wxheading{Event table macros} | |
514 | ||
515 | To process a socket event, use these event handler macros to direct input to member | |
516 | functions that take a wxSocketEvent argument. | |
517 | ||
518 | \twocolwidtha{7cm} | |
519 | \begin{twocollist}\itemsep=0pt | |
520 | \twocolitem{{\bf EVT\_SOCKET(id, func)}}{Process a socket event, supplying the member function.} | |
521 | \end{twocollist}% | |
522 | ||
523 | \wxheading{See also} | |
524 | ||
525 | \helpref{wxSocketHandler}{wxsockethandler},\rtfsp | |
526 | \helpref{wxSocketBase}{wxsocketbase},\rtfsp | |
527 | \helpref{wxSocketClient}{wxsocketclient},\rtfsp | |
528 | \helpref{wxSocketServer}{wxsocketserver} | |
529 | ||
530 | \latexignore{\rtfignore{\wxheading{Members}}} | |
531 | ||
532 | \membersection{wxSocketEvent::wxSocketEvent} | |
533 | ||
534 | \func{}{wxSocketEvent}{\param{int}{ id = 0}} | |
535 | ||
536 | Constructor. | |
537 | ||
538 | \membersection{wxSocketEvent::SocketEvent}\label{wxsocketeventsocketevent} | |
539 | ||
540 | \constfunc{wxSocketBase::wxRequestEvent}{SocketEvent}{\void} | |
541 | ||
542 | Returns the socket event type. | |
543 | ||
544 | % --------------------------------------------------------------------------- | |
545 | % CLASS: wxSocketHandler | |
546 | % --------------------------------------------------------------------------- | |
547 | \section{\class{wxSocketHandler}}\label{wxsockethandler} | |
548 | ||
549 | \wxheading{Derived from} | |
550 | ||
551 | \helpref{wxObject}{wxobject} | |
552 | ||
553 | % --------------------------------------------------------------------------- | |
554 | % Members | |
555 | % --------------------------------------------------------------------------- | |
556 | \latexignore{\rtfignore{\wxheading{Members}}} | |
557 | ||
558 | % | |
559 | % wxSocketHandler | |
560 | % | |
561 | \membersection{wxSocketHandler::wxSocketHandler} | |
562 | ||
563 | \func{}{wxSocketHandler}{\void} | |
564 | ||
565 | Constructs a new wxSocketHandler. | |
566 | ||
567 | It is advised to use \helpref{wxSocketHandler::Master}{wxsockethandlermaster} to | |
568 | get a socket handler. But creating a socket handler is useful to group | |
569 | many sockets. | |
570 | ||
571 | % | |
572 | % ~wxSocketHandler | |
573 | % | |
574 | \membersection{wxSocketHandler::\destruct{wxSocketHandler}} | |
575 | ||
576 | \func{}{\destruct{wxSocketHandler}}{\void} | |
577 | ||
578 | Destructs a wxSocketHandler object. | |
579 | ||
580 | % | |
581 | % Register | |
582 | % | |
583 | \membersection{wxSocketHandler::Register} | |
584 | ||
585 | \func{void}{Register}{\param{wxSocketBase *}{socket}} | |
586 | ||
587 | Register a socket: if it is already registered in this handler it will just | |
588 | return immediately. | |
589 | ||
590 | \wxheading{Parameters} | |
591 | ||
592 | \docparam{socket}{Socket to be registered.} | |
593 | ||
594 | % | |
595 | % UnRegister | |
596 | % | |
597 | \membersection{wxSocketHandler::UnRegister} | |
598 | ||
599 | \func{void}{UnRegister}{\param{wxSocketBase *}{socket}} | |
600 | ||
601 | UnRegister a socket: if it isn't registered in this handler it will just | |
602 | return. | |
603 | ||
604 | \wxheading{Parameters} | |
605 | ||
606 | \docparam{socket}{Socket to be unregistered.} | |
607 | ||
608 | % | |
609 | % Count | |
610 | % | |
611 | \membersection{wxSocketHandler::Count} | |
612 | ||
613 | \constfunc{unsigned long}{Count}{\void} | |
614 | ||
615 | Returns the number of sockets registered in the handler. | |
616 | ||
617 | \wxheading{Return value} | |
618 | ||
619 | Number of sockets registered. | |
620 | ||
621 | % | |
622 | % CreateServer | |
623 | % | |
624 | \membersection{wxSocketHandler::CreateServer} | |
625 | ||
626 | \func{wxSocketServer *}{CreateServer}{\param{wxSockAddress\&}{ address}, \param{wxSocketBase::wxSockFlags}{ flags = wxSocketbase::NONE}} | |
627 | ||
628 | Creates a new wxSocketServer object. The object is automatically registered | |
629 | to the current socket handler. | |
630 | For a detailed description of the parameters, see \helpref{wxSocketServer::wxSocketServer}{wxsocketserverconstr}. | |
631 | ||
632 | \wxheading{Return value} | |
633 | ||
634 | Returns a new socket server. | |
635 | ||
636 | % | |
637 | % CreateClient | |
638 | % | |
639 | \membersection{wxSocketHandler::CreateClient} | |
640 | ||
641 | \func{wxSocketServer *}{CreateClient}{\param{wxSocketBase::wxSockFlags}{ flags = wxSocketbase::NONE}} | |
642 | ||
643 | Creates a new wxSocketClient object. The object is automatically registered | |
644 | to the current socket handler. | |
645 | ||
646 | For a detailed description of the parameters, see \helpref{wxSocketClient::Connect}{wxsocketclientconnect}. | |
647 | ||
648 | \wxheading{Return value} | |
649 | ||
650 | Returns a new socket client. | |
651 | ||
652 | % | |
653 | % Master | |
654 | % | |
655 | \membersection{wxSocketHandler::Master}\label{wxsockethandlermaster} | |
656 | ||
657 | \func{static wxSocketHandler\&}{Master}{\void} | |
658 | ||
659 | Returns a default socket handler. | |
660 | ||
661 | % | |
662 | % Wait | |
663 | % | |
664 | \membersection{wxSocketHandler::Wait} | |
665 | ||
666 | \func{int}{Wait}{\param{long}{ seconds},\param{long}{ microseconds}} | |
667 | ||
668 | Wait for an event on all registered sockets. | |
669 | ||
670 | \wxheading{Parameters} | |
671 | ||
672 | \docparam{seconds}{Number of seconds to wait. By default, it waits infinitely.} | |
673 | ||
674 | \docparam{microsecond}{Number of microseconds to wait.} | |
675 | ||
676 | \wxheading{Return value} | |
677 | ||
678 | Returns 0 if a timeout occured, else the number of events detected. | |
679 | ||
680 | \wxheading{See also} | |
681 | ||
682 | \helpref{wxSocketBase::Wait}{wxsocketbasewait} | |
683 | ||
684 | % | |
685 | % YieldSock | |
686 | % | |
687 | \membersection{wxSocketHandler::YieldSock} | |
688 | ||
689 | \func{void}{YieldSock}{\void} | |
690 | ||
691 | Execute pending requests in all registered sockets. | |
692 | ||
693 | % --------------------------------------------------------------------------- | |
694 | % CLASS: wxSocketServer | |
695 | % --------------------------------------------------------------------------- | |
696 | \section{\class{wxSocketServer}}\label{wxsocketserver} | |
697 | ||
698 | \wxheading{Derived from} | |
699 | ||
700 | \helpref{wxSocketBase}{wxsocketbase} | |
701 | ||
702 | % --------------------------------------------------------------------------- | |
703 | % Members | |
704 | % --------------------------------------------------------------------------- | |
705 | \latexignore{\rtfignore{\wxheading{Members}}} | |
706 | ||
707 | % | |
708 | % wxSocketServer | |
709 | % | |
710 | \membersection{wxSocketServer::wxSocketServer}\label{wxsocketserverconstr} | |
711 | ||
712 | \func{}{wxSocketServer}{\param{wxSockAddress\&}{ address}, \param{wxSockFlags}{ flags = wxSocketBase::NONE}} | |
713 | ||
714 | Constructs a new wxSocketServer. | |
715 | ||
716 | {\bf Warning !} The created object needs to be registered to a socket handler | |
717 | (see \helpref{wxSocketHandler}{wxsockethandler}). | |
718 | ||
719 | \wxheading{Parameters} | |
720 | ||
721 | \docparam{address}{Specifies the local address for the server (e.g. port number).} | |
722 | ||
723 | \docparam{flags}{Socket flags (See \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags})} | |
724 | ||
725 | % | |
726 | % ~wxSocketServer | |
727 | % | |
728 | \membersection{wxSocketServer::\destruct{wxSocketServer}} | |
729 | ||
730 | \func{}{\destruct{wxSocketServer}}{\void} | |
731 | ||
732 | Destructs a wxSocketServer object (it doesn't close the accepted connection). | |
733 | ||
734 | % | |
735 | % Accept | |
736 | % | |
737 | \membersection{wxSocketServer::Accept} | |
738 | ||
739 | \func{wxSocketBase *}{Accept}{\void} | |
740 | ||
741 | Creates a new object wxSocketBase and accepts an incoming connection. {\bf Warning !} This function will block the GUI. | |
742 | ||
743 | \wxheading{Return value} | |
744 | ||
745 | Returns an opened socket connection. | |
746 | ||
747 | \wxheading{See also} | |
748 | ||
749 | \helpref{wxSocketServer::AcceptWith}{wxsocketserveracceptwith} | |
750 | ||
751 | % | |
752 | % AcceptWith | |
753 | % | |
754 | \membersection{wxSocketServer::AcceptWith}\label{wxsocketserveracceptwith} | |
755 | ||
756 | \func{bool}{AcceptWith}{\param{wxSocketBase\&}{ socket}} | |
757 | ||
758 | Accept an incoming connection using the specified socket object. | |
759 | This is useful when someone wants to inherit wxSocketBase. | |
760 | ||
761 | \wxheading{Parameters} | |
762 | ||
763 | \docparam{socket}{Socket to be initialized} | |
764 | ||
765 | \wxheading{Return value} | |
766 | ||
767 | Returns TRUE if no error occurs, else FALSE. | |
768 | ||
769 |