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