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