]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/socket.tex
fixed configure script for Solaris
[wxWidgets.git] / docs / latex / wx / socket.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: socket.tex
3 %% Purpose: wxSocket docs
4 %% Author: Guillermo Rodriguez Garcia <guille@iies.es>
5 %% Modified by:
6 %% Created: 1999
7 %% RCS-ID: $Id$
8 %% Copyright: (c) wxWindows team
9 %% Licence: wxWindows licence
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 \section{\class{wxSocketBase}}\label{wxsocketbase}
13
14 wxSocketBase is the base class for all socket-related objects, and it
15 defines all basic IO functionality.
16
17 \wxheading{Derived from}
18
19 \helpref{wxEvtHandler}{wxevthandler}
20
21 \wxheading{Include files}
22
23 <wx/socket.h>
24
25 \wxheading{wxSocket errors}
26
27 \twocolwidtha{7cm}
28 \begin{twocollist}\itemsep=0pt
29 \twocolitem{{\bf wxSOCKET\_NOERROR}}{No error happened.}
30 \twocolitem{{\bf wxSOCKET\_INVOP}}{Invalid operation.}
31 \twocolitem{{\bf wxSOCKET\_IOERR}}{Input/Output error.}
32 \twocolitem{{\bf wxSOCKET\_INVADDR}}{Invalid address passed to wxSocket.}
33 \twocolitem{{\bf wxSOCKET\_INVSOCK}}{Invalid socket (uninitialized).}
34 \twocolitem{{\bf wxSOCKET\_NOHOST}}{No corresponding host.}
35 \twocolitem{{\bf wxSOCKET\_INVPORT}}{Invalid port.}
36 \twocolitem{{\bf wxSOCKET\_WOULDBLOCK}}{The socket is non-blocking and the operation would block.}
37 \twocolitem{{\bf wxSOCKET\_TIMEDOUT}}{The timeout for this operation expired.}
38 \twocolitem{{\bf wxSOCKET\_MEMERR}}{Memory exhausted.}
39 \end{twocollist}
40
41 \wxheading{wxSocket events}
42
43 \twocolwidtha{7cm}
44 \begin{twocollist}\itemsep=0pt
45 \twocolitem{{\bf wxSOCKET\_INPUT}}{There is data available for reading.}
46 \twocolitem{{\bf wxSOCKET\_OUTPUT}}{The socket is ready to be written to.}
47 \twocolitem{{\bf wxSOCKET\_CONNECTION}}{Incoming connection (server), or connection establishment (client).}
48 \twocolitem{{\bf wxSOCKET\_LOST}}{The connection has been closed.}
49 \end{twocollist}
50
51 A brief note on how to use these events:
52
53 The {\bf wxSOCKET\_INPUT} event will be issued whenever there is data
54 available for reading. This will be the case if the input queue was
55 empty and new data arrives, or if the application has read some data
56 yet there is still more data available. This means that the application
57 does not need to read all available data in response to a
58 {\bf wxSOCKET\_INPUT} event, as more events will be produced as
59 necessary.
60
61 The {\bf wxSOCKET\_OUTPUT} event is issued when a socket is first
62 connected with \helpref{Connect}{wxsocketclientconnect} or accepted
63 with \helpref{Accept}{wxsocketserveraccept}. After that, new
64 events will be generated only after an output operation fails
65 with {\bf wxSOCKET\_WOULDBLOCK} and buffer space becomes available
66 again. This means that the application should assume that it
67 can write data to the socket until an {\bf wxSOCKET\_WOULDBLOCK}
68 error occurs; after this, whenever the socket becomes writable
69 again the application will be notified with another
70 {\bf wxSOCKET\_OUTPUT} event.
71
72 The {\bf wxSOCKET\_CONNECTION} event is issued when a delayed connection
73 request completes succesfully (client) or when a new connection arrives
74 at the incoming queue (server).
75
76 The {\bf wxSOCKET\_LOST} event is issued when a close indication is
77 received for the socket. This means that the connection broke down or
78 that it was closed by the peer. Also, this event will be issued if
79 a delayed connection request fails.
80
81 \wxheading{Event handling}
82
83 To process events coming from a socket object, use the following event
84 handler macro to direct events to member functions that take a
85 \helpref{wxSocketEvent}{wxsocketevent} argument.
86
87 \twocolwidtha{7cm}%
88 \begin{twocollist}\itemsep=0pt
89 \twocolitem{{\bf EVT\_SOCKET(id, func)}}{Process a wxEVT\_SOCKET event.}
90 \end{twocollist}
91
92 \wxheading{See also}
93
94 \helpref{wxSocketEvent}{wxsocketevent},
95 \helpref{wxSocketClient}{wxsocketclient},
96 \helpref{wxSocketServer}{wxsocketserver},
97 \helpref{Sockets sample}{samplesockets}
98
99 % ---------------------------------------------------------------------------
100 % Function groups
101 % ---------------------------------------------------------------------------
102
103 \latexignore{\rtfignore{\wxheading{Function groups}}}
104
105 \membersection{Construction and destruction}
106
107 \helpref{wxSocketBase}{wxsocketbaseconstruct}\\
108 \helpref{\destruct{wxSocketBase}}{wxsocketbasedestruct}\\
109 \helpref{wxDestroy}{wxsocketbasedestroy}
110
111 \membersection{Socket state}
112
113 Functions to retrieve current state and miscellaneous info.
114
115 \helpref{Error}{wxsocketbaseerror}\\
116 \helpref{GetLocal}{wxsocketbasegetlocal}\\
117 \helpref{GetPeer}{wxsocketbasegetpeer}
118 \helpref{IsConnected}{wxsocketbaseisconnected}\\
119 \helpref{IsData}{wxsocketbaseisdata}\\
120 \helpref{IsDisconnected}{wxsocketbaseisdisconnected}\\
121 \helpref{LastCount}{wxsocketbaselastcount}\\
122 \helpref{LastError}{wxsocketbaselasterror}\\
123 \helpref{Ok}{wxsocketbaseok}\\
124 \helpref{SaveState}{wxsocketbasesavestate}\\
125 \helpref{RestoreState}{wxsocketbaserestorestate}
126
127 \membersection{Basic IO}
128
129 Functions that perform basic IO functionality.
130
131 \helpref{Close}{wxsocketbaseclose}\\
132 \helpref{Discard}{wxsocketbasediscard}\\
133 \helpref{Peek}{wxsocketbasepeek}\\
134 \helpref{Read}{wxsocketbaseread}\\
135 \helpref{ReadMsg}{wxsocketbasereadmsg}\\
136 \helpref{Unread}{wxsocketbaseunread}\\
137 \helpref{Write}{wxsocketbasewrite}\\
138 \helpref{WriteMsg}{wxsocketbasewritemsg}
139
140 Functions that perform a timed wait on a certain IO condition.
141
142 \helpref{Wait}{wxsocketbasewait}\\
143 \helpref{WaitForRead}{wxsocketbasewaitforread}\\
144 \helpref{WaitForWrite}{wxsocketbasewaitforwrite}\\
145 \helpref{WaitForLost}{wxsocketbasewaitforlost}
146
147 Functions that allow applications to customize socket IO as needed.
148
149 \helpref{SetFlags}{wxsocketbasesetflags}\\
150 \helpref{SetTimeout}{wxsocketbasesettimeout}
151
152 \membersection{Handling socket events}
153
154 Functions that allow applications to receive socket events.
155
156 \helpref{Notify}{wxsocketbasenotify}\\
157 \helpref{SetNotify}{wxsocketbasesetnotify}\\
158 \helpref{SetEventHandler}{wxsocketbaseseteventhandler}
159
160 Callback functions are also available, but they are provided for backwards
161 compatibility only. Their use is discouraged in favour of events, and should
162 be considered deprecated.
163
164 \helpref{Callback}{wxsocketbasecallback}\\
165 \helpref{CallbackData}{wxsocketbasecallbackdata}
166
167
168 % ---------------------------------------------------------------------------
169 % Members here
170 % ---------------------------------------------------------------------------
171
172 \helponly{\insertatlevel{2}{
173
174 \wxheading{Members}
175
176 }}
177
178 \membersection{wxSocketBase::wxSocketBase}\label{wxsocketbaseconstruct}
179
180 \func{}{wxSocketBase}{\void}
181
182 Default constructor. Don't use it directly; instead, use
183 \helpref{wxSocketClient}{wxsocketclient} to construct a socket client, or
184 \helpref{wxSocketServer}{wxsocketserver} to construct a socket server.
185
186 \membersection{wxSocketBase::\destruct{wxSocketBase}}\label{wxsocketbasedestruct}
187
188 \func{}{\destruct{wxSocketBase}}{\void}
189
190 Destructor. Do not destroy a socket using the delete operator directly;
191 use \helpref{Destroy}{wxsocketbasedestroy} instead. Also, do not create socket
192 objects in the stack.
193
194 %
195 % Callback
196 %
197 \membersection{wxSocketBase::Callback}\label{wxsocketbasecallback}
198
199 \func{wxSocketBase::wxSockCbk}{Callback}{\param{wxSocketBase::wxSockCbk}{ callback}}
200
201 You can setup a callback function to be called when an event occurs.
202 The function will be called only for those events for which notification
203 has been enabled with \helpref{Notify}{wxsocketbasenotify} and
204 \helpref{SetNotify}{wxsocketbasesetnotify}. The prototype of the
205 callback must be as follows:
206
207 \begin{verbatim}
208 void SocketCallback(wxSocketBase& sock, wxSocketNotify evt, char *cdata);
209 \end{verbatim}
210
211 The first parameter is a reference to the socket object in which the
212 event occured. The second parameter tells you which event occured.
213 (See \helpref{wxSocket events}{wxsocketbase}). The third parameter
214 is the user data you specified using
215 \helpref{CallbackData}{wxsocketbasecallbackdata}.
216
217 Note that events are preferred over callbacks where possible.
218
219 \wxheading{Return value}
220
221 A pointer to the previous callback.
222
223 \wxheading{See also}
224
225 \helpref{wxSocketBase::CallbackData}{wxsocketbasecallbackdata},
226 \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify},
227 \helpref{wxSocketBase::Notify}{wxsocketbasenotify}
228
229 %
230 % CallbackData
231 %
232 \membersection{wxSocketBase::CallbackData}\label{wxsocketbasecallbackdata}
233
234 \func{char *}{CallbackData}{\param{char *}{cdata}}
235
236 This function sets the the user data which will be passed to a
237 callback function set via \helpref{Callback}{wxsocketbasecallback}.
238
239 Note that events are preferred over callbacks where possible.
240
241 \wxheading{Return value}
242
243 A pointer to the previous user data.
244
245 \helpref{wxSocketBase::Callback}{wxsocketbasecallback},
246 \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify},
247 \helpref{wxSocketBase::Notify}{wxsocketbasenotify}
248
249 %
250 % Close
251 %
252 \membersection{wxSocketBase::Close}\label{wxsocketbaseclose}
253
254 \func{void}{Close}{\void}
255
256 This function shuts down the socket, disabling further transmission and
257 reception of data; it also disables events for the socket and frees the
258 associated system resources. Upon socket destruction, Close is automatically
259 called. This means that you don't need to do it yourself, unless you
260 explicitly want to disable further operation.
261
262 \wxheading{Remark/Warning}
263
264 Although Close immediately disables events for the socket, it is possible
265 that event messages may be waiting in the application's event queue. The
266 application must therefore be prepared to handle socket event messages
267 even after calling Close.
268
269 %
270 % Destroy
271 %
272 \membersection{wxSocketBase::Destroy}\label{wxsocketbasedestroy}
273
274 \func{bool}{Destroy}{\void}
275
276 Destroys the socket safely. Use this function instead of the delete operator,
277 since otherwise socket events could reach the application even after the
278 socket has been destroyed. To prevent this problem, this function appends
279 the wxSocket to a list of object to be deleted on idle time, after all
280 events have been processed. For the same reason, you should avoid creating
281 socket objects in the stack.
282
283 Destroy calls \helpref{Close}{wxsocketbaseclose} automatically.
284
285 \wxheading{Return value}
286
287 Always TRUE.
288
289 %
290 % Discard
291 %
292 \membersection{wxSocketBase::Discard}\label{wxsocketbasediscard}
293
294 \func{wxSocketBase\&}{Discard}{\void}
295
296 This function simply deletes all bytes in the incoming queue. This function
297 always returns immediately and its operation is not affected by IO flags.
298
299 Use \helpref{LastCount}{wxsocketbaselastcount} to verify the number of bytes actually discarded.
300
301 If you use \helpref{Error}{wxsocketbaseerror}, it will always return FALSE.
302
303 %
304 % Error
305 %
306 \membersection{wxSocketBase::Error}\label{wxsocketbaseerror}
307
308 \constfunc{bool}{Error}{\void}
309
310 Returns TRUE if an error occured in the last IO operation.
311
312 Use this function to check for an error condition after one of the
313 following calls: Discard, Peek, Read, ReadMsg, Unread, Write, WriteMsg.
314
315 %
316 % GetLocal
317 %
318 \membersection{wxSocketBase::GetLocal}\label{wxsocketbasegetlocal}
319
320 \constfunc{bool}{GetLocal}{\param{wxSockAddress\& }{addr\_man}}
321
322 This function returns the local address field of the socket. The local
323 address field contains the complete local address of the socket (local
324 address, local port, ...).
325
326 \wxheading{Return value}
327
328 It returns TRUE if no errors happened, FALSE otherwise.
329
330 %
331 % GetPeer
332 %
333 \membersection{wxSocketBase::GetPeer}\label{wxsocketbasegetpeer}
334
335 \constfunc{bool}{GetPeer}{\param{wxSockAddress\& }{addr\_man}}
336
337 This function returns the peer address field of the socket. The peer
338 address field contains the complete peer host address of the socket
339 (address, port, ...).
340
341 \wxheading{Return value}
342
343 It returns TRUE if no errors happened, FALSE otherwise.
344
345 %
346 % IsConnected
347 %
348 \membersection{wxSocketBase::IsConnected}\label{wxsocketbaseisconnected}
349
350 \constfunc{bool}{IsConnected}{\void}
351
352 Returns TRUE if the socket is connected.
353
354 %
355 % IsData
356 %
357 \membersection{wxSocketBase::IsData}\label{wxsocketbaseisdata}
358
359 \constfunc{bool}{IsData}{\void}
360
361 This function waits until the socket is readable. This might mean that
362 queued data is available for reading or, for streamed sockets, that
363 the connection has been closed, so that a read operation will complete
364 immediately without blocking (unless the {\bf wxSOCKET\_WAITALL} flag
365 is set, in which case the operation might still block).
366
367 \membersection{wxSocketBase::IsDisconnected}\label{wxsocketbaseisdisconnected}
368
369 %
370 % IsDisconnected
371 %
372 \constfunc{bool}{IsDisconnected}{\void}
373
374 Returns TRUE if the socket is not connected.
375
376 \membersection{wxSocketBase::LastCount}\label{wxsocketbaselastcount}
377
378 %
379 % LastCount
380 %
381 \constfunc{wxUint32}{LastCount}{\void}
382
383 Returns the number of bytes read or written by the last IO call.
384
385 Use this function to get the number of bytes actually transferred
386 after using one of the following IO calls: Discard, Peek, Read,
387 ReadMsg, Unread, Write, WriteMsg.
388
389 %
390 % LastError
391 %
392 \membersection{wxSocketBase::LastError}\label{wxsocketbaselasterror}
393
394 \constfunc{wxSocketError}{LastError}{\void}
395
396 Returns the last wxSocket error. See \helpref{wxSocket errors}{wxsocketbase}.
397
398 Please note that this function merely returns the last error code,
399 but it should not be used to determine if an error has occured (this
400 is because successful operations do not change the LastError value).
401 Use \helpref{Error}{wxsocketbaseerror} first, in order to determine
402 if the last IO call failed. If this returns TRUE, use LastError
403 to discover the cause of the error.
404
405 %
406 % Notify
407 %
408 \membersection{wxSocketBase::Notify}\label{wxsocketbasenotify}
409
410 \func{void}{Notify}{\param{bool}{ notify}}
411
412 According to the {\it notify} value, this function enables
413 or disables socket events. If {\it notify} is TRUE, the events
414 configured with \helpref{SetNotify}{wxsocketbasesetnotify} will
415 be sent to the application. If {\it notify} is FALSE; no events
416 will be sent.
417
418 %
419 % Ok
420 %
421 \membersection{wxSocketBase::Ok}\label{wxsocketbaseok}
422
423 \constfunc{bool}{Ok}{\void}
424
425 Returns TRUE if the socket is initialized and ready and FALSE in other
426 cases.
427
428 \wxheading{Remark/Warning}
429
430 For \helpref{wxSocketClient}{wxsocketclient}, Ok won't return TRUE unless
431 the client is connected to a server.
432
433 For \helpref{wxSocketServer}{wxsocketserver}, Ok will return TRUE if the
434 server could bind to the specified address and is already listening for
435 new connections.
436
437 Ok does not check for IO errors; use \helpref{Error}{wxsocketbaseerror}
438 instead for that purpose.
439
440 %
441 % RestoreState
442 %
443 \membersection{wxSocketBase::RestoreState}\label{wxsocketbaserestorestate}
444
445 \func{void}{RestoreState}{\void}
446
447 This function restores the previous state of the socket, as saved
448 with \helpref{SaveState}{wxsocketbasesavestate}
449
450 Calls to SaveState and RestoreState can be nested.
451
452 \wxheading{See also}
453
454 \helpref{wxSocketBase::SaveState}{wxsocketbasesavestate}
455
456 %
457 % SaveState
458 %
459 \membersection{wxSocketBase::SaveState}\label{wxsocketbasesavestate}
460
461 \func{void}{SaveState}{\void}
462
463 This function saves the current state of the socket in a stack. Socket
464 state includes flags, as set with \helpref{SetFlags}{wxsocketbasesetflags},
465 event mask, as set with \helpref{SetNotify}{wxsocketbasesetnotify} and
466 \helpref{Notify}{wxsocketbasenotify}, and current settings for the
467 asynchronous callbacks, as set with \helpref{Callback}{wxsocketbasecallback}
468 and \helpref{CallbackData}{wxsocketbasecallbackdata}.
469
470 Calls to SaveState and RestoreState can be nested.
471
472 \wxheading{See also}
473
474 \helpref{wxSocketBase::RestoreState}{wxsocketbaserestorestate}
475
476 %
477 % SetEventHandler
478 %
479 \membersection{wxSocketBase::SetEventHandler}\label{wxsocketbaseseteventhandler}
480
481 \func{void}{SetEventHandler}{\param{wxEvtHandler\&}{ evt\_hdlr}, \param{int}{ id = -1}}
482
483 Sets an event handler to be called when a socket event occurs. The
484 handler will be called for those events for which notification is
485 enabled with \helpref{SetNotify}{wxsocketbasesetnotify} and
486 \helpref{Notify}{wxsocketbasenotify}.
487
488 You can also specify a callback function to be called when an event
489 occurs, although if possible, events should be used instead of callbacks.
490 See \helpref{Callback}{wxsocketbasecallback} and
491 \helpref{CallbackData}{wxsocketbasecallbackdata}.
492
493 \wxheading{Parameters}
494
495 \docparam{evt\_hdlr}{Specifies the event handler you want to use.}
496
497 \docparam{id}{The id of socket event.}
498
499 \wxheading{See also}
500
501 \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify},
502 \helpref{wxSocketBase::Notify}{wxsocketbasenotify},
503 \helpref{wxSocketEvent}{wxsocketevent},
504 \helpref{wxEvtHandler}{wxevthandler},
505 \helpref{wxSocketBase::Callback}{wxsocketbasecallback},
506 \helpref{wxSocketBase::CallbackData}{wxsocketbasecallbackdata}
507
508 %
509 % SetFlags
510 %
511 \membersection{wxSocketBase::SetFlags}\label{wxsocketbasesetflags}
512
513 \func{void}{SetFlags}{\param{wxSocketBase::wxSocketFlags}{ flags}}
514
515 \twocolwidtha{7cm}
516 \begin{twocollist}\itemsep=0pt
517 \twocolitem{{\bf wxSOCKET\_NONE}}{Normal functionality.}
518 \twocolitem{{\bf wxSOCKET\_NOWAIT}}{Read/write as much data as possible and return immediately.}
519 \twocolitem{{\bf wxSOCKET\_WAITALL}}{Wait for all required data to be read/written unless an error occurs.}
520 \twocolitem{{\bf wxSOCKET\_BLOCK}}{Block the GUI (do not yield) while reading/writing data.}
521 \end{twocollist}
522
523 A brief overview on how to use these flags follows.
524
525 If no flag is specified (this is the same as {\bf wxSOCKET\_NONE}),
526 IO calls will return after some data has been read or written, even
527 when the transfer might not be complete. This is the same as issuing
528 exactly one blocking low-level call to recv() or send(). Note that
529 {\it blocking} here refers to when the function returns, not to whether
530 the GUI blocks during this time.
531
532 If {\bf wxSOCKET\_NOWAIT} is specified, IO calls will return immediately.
533 Read operations will retrieve only available data. Write operations will
534 write as much data as possible, depending on how much space is available
535 in the output buffer. This is the same as issuing exactly one nonblocking
536 low-level call to recv() or send(). Note that {\it nonblocking} here
537 refers to when the function returns, not to whether the GUI blocks during
538 this time.
539
540 If {\bf wxSOCKET\_WAITALL} is specified, IO calls won't return until ALL
541 the data has been read or written (or until an error occurs), blocking if
542 necessary, and issuing several low level calls if necessary. This is the
543 same as having a loop which makes as many blocking low-level calls to
544 recv() or send() as needed so as to transfer all the data. Note that
545 {\it blocking} here refers to when the function returns, not to whether
546 the GUI blocks during this time.
547
548 The {\bf wxSOCKET\_BLOCK} flag controls whether the GUI blocks during
549 IO operations. If this flag is specified, the socket will not yield
550 during IO calls, so the GUI will remain blocked until the operation
551 completes. If it is not used, then the application must take extra
552 care to avoid unwanted reentrance.
553
554 So:
555
556 {\bf wxSOCKET\_NONE} will try to read at least SOME data, no matter how much.
557
558 {\bf wxSOCKET\_NOWAIT} will always return immediately, even if it cannot
559 read or write ANY data.
560
561 {\bf wxSOCKET\_WAITALL} will only return when it has read or written ALL
562 the data.
563
564 {\bf wxSOCKET\_BLOCK} has nothing to do with the previous flags and
565 it controls whether the GUI blocks.
566
567 %
568 % SetNotify
569 %
570 \membersection{wxSocketBase::SetNotify}\label{wxsocketbasesetnotify}
571
572 \func{void}{SetNotify}{\param{wxSocketEventFlags}{ flags}}
573
574 SetNotify specifies which socket events are to be sent to the event handler.
575 The {\it flags} parameter is a combination of flags ORed toghether. The
576 following flags can be used:
577
578 \twocolwidtha{7cm}
579 \begin{twocollist}\itemsep=0pt
580 \twocolitem{{\bf wxSOCKET\_INPUT\_FLAG}}{to receive wxSOCKET\_INPUT}
581 \twocolitem{{\bf wxSOCKET\_OUTPUT\_FLAG}}{to receive wxSOCKET\_OUTPUT}
582 \twocolitem{{\bf wxSOCKET\_CONNECTION\_FLAG}}{to receive wxSOCKET\_CONNECTION}
583 \twocolitem{{\bf wxSOCKET\_LOST\_FLAG}}{to receive wxSOCKET\_LOST}
584 \end{twocollist}
585
586 For example:
587
588 \begin{verbatim}
589 sock.SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
590 sock.Notify(TRUE);
591 \end{verbatim}
592
593 In this example, the user will be notified about incoming socket data and
594 whenever the connection is closed.
595
596 For more information on socket events see \helpref{wxSocket events}{wxsocketbase}.
597
598 %
599 % SetTimeout
600 %
601 \membersection{wxSocketBase::SetTimeout}\label{wxsocketbasesettimeout}
602
603 \func{void}{SetTimeout}{\param{int }{seconds}}
604
605 This function sets the default socket timeout in seconds. This timeout
606 applies to all IO calls, and also to the \helpref{Wait}{wxsocketbasewait}
607 family of functions if you don't specify a wait interval. Initially, the
608 default is set to 10 minutes.
609
610 %
611 % Peek
612 %
613 \membersection{wxSocketBase::Peek}\label{wxsocketbasepeek}
614
615 \func{wxSocketBase\&}{Peek}{\param{void *}{ buffer}, \param{wxUint32}{ nbytes}}
616
617 This function peeks a buffer of {\it nbytes} bytes from the socket.
618 Peeking a buffer doesn't delete it from the socket input queue.
619
620 Use \helpref{LastCount}{wxsocketbaselastcount} to verify the number of bytes actually peeked.
621
622 Use \helpref{Error}{wxsocketbaseerror} to determine if the operation succeeded.
623
624 \wxheading{Parameters}
625
626 \docparam{buffer}{Buffer where to put peeked data.}
627
628 \docparam{nbytes}{Number of bytes.}
629
630 \wxheading{Return value}
631
632 Returns a reference to the current object.
633
634 \wxheading{Remark/Warning}
635
636 The exact behaviour of wxSocketBase::Peek depends on the combination
637 of flags being used. For a detailed explanation, see \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags}
638
639 \wxheading{See also}
640
641 \helpref{wxSocketBase::Error}{wxsocketbaseerror},
642 \helpref{wxSocketBase::LastError}{wxsocketbaselasterror},
643 \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount},
644 \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags}
645
646 %
647 % Read
648 %
649 \membersection{wxSocketBase::Read}\label{wxsocketbaseread}
650
651 \func{wxSocketBase\&}{Read}{\param{void *}{ buffer}, \param{wxUint32}{ nbytes}}
652
653 This function reads a buffer of {\it nbytes} bytes from the socket.
654
655 Use \helpref{LastCount}{wxsocketbaselastcount} to verify the number of bytes actually read.
656
657 Use \helpref{Error}{wxsocketbaseerror} to determine if the operation succeeded.
658
659 \wxheading{Parameters}
660
661 \docparam{buffer}{Buffer where to put read data.}
662
663 \docparam{nbytes}{Number of bytes.}
664
665 \wxheading{Return value}
666
667 Returns a reference to the current object.
668
669 \wxheading{Remark/Warning}
670
671 The exact behaviour of wxSocketBase::Read depends on the combination
672 of flags being used. For a detailed explanation, see \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags}.
673
674 \wxheading{See also}
675
676 \helpref{wxSocketBase::Error}{wxsocketbaseerror},
677 \helpref{wxSocketBase::LastError}{wxsocketbaselasterror},
678 \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount},
679 \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags}
680
681 %
682 % ReadMsg
683 %
684 \membersection{wxSocketBase::ReadMsg}\label{wxsocketbasereadmsg}
685
686 \func{wxSocketBase\&}{ReadMsg}{\param{void *}{ buffer}, \param{wxUint32}{ nbytes}}
687
688 This function reads a buffer sent by \helpref{WriteMsg}{wxsocketbasewritemsg}
689 on a socket. If the buffer passed to the function isn't big enough, the
690 remaining bytes will be discarded. This function always waits for the
691 buffer to be entirely filled, unless an error occurs.
692
693 Use \helpref{LastCount}{wxsocketbaselastcount} to verify the number of bytes actually read.
694
695 Use \helpref{Error}{wxsocketbaseerror} to determine if the operation succeeded.
696
697 \wxheading{Parameters}
698
699 \docparam{buffer}{Buffer where to put read data.}
700
701 \docparam{nbytes}{Size of the buffer.}
702
703 \wxheading{Return value}
704
705 Returns a reference to the current object.
706
707 \wxheading{Remark/Warning}
708
709 wxSocketBase::ReadMsg will behave as if the {\bf wxSOCKET\_WAITALL} flag
710 was always set and it will always ignore the {\bf wxSOCKET\_NOWAIT} flag.
711 The exact behaviour of ReadMsg depends on the {\bf wxSOCKET\_BLOCK} flag.
712 For a detailed explanation, see \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags}.
713
714 \wxheading{See also}
715
716 \helpref{wxSocketBase::Error}{wxsocketbaseerror},
717 \helpref{wxSocketBase::LastError}{wxsocketbaselasterror},
718 \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount},
719 \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags},
720 \helpref{wxSocketBase::WriteMsg}{wxsocketbasewritemsg}
721
722 %
723 % Unread
724 %
725 \membersection{wxSocketBase::Unread}\label{wxsocketbaseunread}
726
727 \func{wxSocketBase\&}{Unread}{\param{const void *}{ buffer}, \param{wxUint32}{ nbytes}}
728
729 This function unreads a buffer. That is, the data in the buffer is put back
730 in the incoming queue. This function is not affected by wxSocket flags.
731
732 If you use \helpref{LastCount}{wxsocketbaselastcount}, it will always return {\it nbytes}.
733
734 If you use \helpref{Error}{wxsocketbaseerror}, it will always return FALSE.
735
736 \wxheading{Parameters}
737
738 \docparam{buffer}{Buffer to be unread.}
739
740 \docparam{nbytes}{Number of bytes.}
741
742 \wxheading{Return value}
743
744 Returns a reference to the current object.
745
746 \wxheading{See also}
747
748 \helpref{wxSocketBase::Error}{wxsocketbaseerror},
749 \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount},
750 \helpref{wxSocketBase::LastError}{wxsocketbaselasterror}
751
752 %
753 % Wait
754 %
755 \membersection{wxSocketBase::Wait}\label{wxsocketbasewait}
756
757 \func{bool}{Wait}{\param{long}{ seconds = -1}, \param{long}{ millisecond = 0}}
758
759 This function waits until one of the following conditions is TRUE. Note
760 that it is recommended to use the individual Wait functions to wait for
761 the required condition, instead of this one.
762
763 \begin{itemize}
764 \item The socket becomes readable.
765 \item The socket becomes writable.
766 \item An ongoing connection request has completed (only for clients)
767 \item An incoming connection request has arrived (only for servers)
768 \item The connection has been closed.
769 \end{itemize}
770
771 \wxheading{Parameters}
772
773 \docparam{seconds}{Number of seconds to wait.
774 If -1, it will wait for the default timeout,
775 as set with \helpref{SetTimeout}{wxsocketbasesettimeout}.}
776
777 \docparam{millisecond}{Number of milliseconds to wait.}
778
779 \wxheading{Return value}
780
781 Returns TRUE when any of the above conditions is satisfied,
782 FALSE if the timeout was reached.
783
784 \wxheading{See also}
785
786 \helpref{wxSocketBase::WaitForRead}{wxsocketbasewaitforread},
787 \helpref{wxSocketBase::WaitForWrite}{wxsocketbasewaitforwrite},
788 \helpref{wxSocketBase::WaitForLost}{wxsocketbasewaitforlost}
789
790 %
791 % WaitForRead
792 %
793 \membersection{wxSocketBase::WaitForRead}\label{wxsocketbasewaitforread}
794
795 \func{bool}{WaitForRead}{\param{long}{ seconds = -1}, \param{long}{ millisecond = 0}}
796
797 This function waits until the socket is readable. This might mean that
798 queued data is available for reading or, for streamed sockets, that
799 the connection has been closed, so that a read operation will complete
800 immediately without blocking (unless the {\bf wxSOCKET\_WAITALL} flag
801 is set, in which case the operation might still block).
802
803 \wxheading{Parameters}
804
805 \docparam{seconds}{Number of seconds to wait.
806 If -1, it will wait for the default timeout,
807 as set with \helpref{SetTimeout}{wxsocketbasesettimeout}.}
808
809 \docparam{millisecond}{Number of milliseconds to wait.}
810
811 \wxheading{Return value}
812
813 Returns TRUE if the socket becomes readable, FALSE on timeout.
814
815 \wxheading{See also}
816
817 \helpref{wxSocketBase::Wait}{wxsocketbasewait},
818 \helpref{wxSocketBase::WaitForWrite}{wxsocketbasewaitforwrite},
819 \helpref{wxSocketBase::WaitForLost}{wxsocketbasewaitforlost}
820
821 %
822 % WaitForWrite
823 %
824 \membersection{wxSocketBase::WaitForWrite}\label{wxsocketbasewaitforwrite}
825
826 \func{bool}{WaitForWrite}{\param{long}{ seconds = -1}, \param{long}{ millisecond = 0}}
827
828 This function waits until the socket becomes writable. This might mean that
829 the socket is ready to send new data, or for streamed sockets, that the
830 connection has been closed, so that a write operation is guaranteed to
831 complete immediately (unless the {\bf wxSOCKET\_WAITALL} flag is set,
832 in which case the operation might still block).
833
834 \wxheading{Parameters}
835
836 \docparam{seconds}{Number of seconds to wait.
837 If -1, it will wait for the default timeout,
838 as set with \helpref{SetTimeout}{wxsocketbasesettimeout}.}
839
840 \docparam{millisecond}{Number of milliseconds to wait.}
841
842 \wxheading{Return value}
843
844 Returns TRUE if the socket becomes writable, FALSE on timeout.
845
846 \wxheading{See also}
847
848 \helpref{wxSocketBase::Wait}{wxsocketbasewait},
849 \helpref{wxSocketBase::WaitForRead}{wxsocketbasewaitforread},
850 \helpref{wxSocketBase::WaitForLost}{wxsocketbasewaitforlost}
851
852 %
853 % WaitForLost
854 %
855 \membersection{wxSocketBase::WaitForLost}\label{wxsocketbasewaitforlost}
856
857 \func{bool}{Wait}{\param{long}{ seconds = -1}, \param{long}{ millisecond = 0}}
858
859 This function waits until the connection is lost. This may happen if
860 the peer gracefully closes the connection or if the connection breaks.
861
862 \wxheading{Parameters}
863
864 \docparam{seconds}{Number of seconds to wait.
865 If -1, it will wait for the default timeout,
866 as set with \helpref{SetTimeout}{wxsocketbasesettimeout}.}
867
868 \docparam{millisecond}{Number of milliseconds to wait.}
869
870 \wxheading{Return value}
871
872 Returns TRUE if the connection was lost, FALSE if the timeout was reached.
873
874 \wxheading{See also}
875
876 \helpref{wxSocketBase::WaitForRead}{wxsocketbasewaitforread},
877 \helpref{wxSocketBase::WaitForWrite}{wxsocketbasewaitforwrite},
878 \helpref{wxSocketBase::WaitForLost}{wxsocketbasewaitforlost}
879
880 %
881 % Write
882 %
883 \membersection{wxSocketBase::Write}\label{wxsocketbasewrite}
884
885 \func{wxSocketBase\&}{Write}{\param{const void *}{ buffer}, \param{wxUint32}{ nbytes}}
886
887 This function writes a buffer of {\it nbytes} bytes to the socket.
888
889 Use \helpref{LastCount}{wxsocketbaselastcount} to verify the number of bytes actually written.
890
891 Use \helpref{Error}{wxsocketbaseerror} to determine if the operation succeeded.
892
893 \wxheading{Parameters}
894
895 \docparam{buffer}{Buffer with the data to be sent.}
896
897 \docparam{nbytes}{Number of bytes.}
898
899 \wxheading{Return value}
900
901 Returns a reference to the current object.
902
903 \wxheading{Remark/Warning}
904
905 The exact behaviour of wxSocketBase::Write depends on the combination
906 of flags being used. For a detailed explanation, see \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags}.
907
908 \wxheading{See also}
909
910 \helpref{wxSocketBase::Error}{wxsocketbaseerror},
911 \helpref{wxSocketBase::LastError}{wxsocketbaselasterror},
912 \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount},
913 \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags}
914
915 %
916 % WriteMsg
917 %
918 \membersection{wxSocketBase::WriteMsg}\label{wxsocketbasewritemsg}
919
920 \func{wxSocketBase\&}{WriteMsg}{\param{const void *}{ buffer}, \param{wxUint32}{ nbytes}}
921
922 This function writes a buffer of {\it nbytes} bytes from the socket, but it
923 writes a short header before so that \helpref{ReadMsg}{wxsocketbasereadmsg}
924 knows how much data should it actually read. So, a buffer sent with WriteMsg
925 {\bf must} be read with ReadMsg. This function always waits for the entire
926 buffer to be sent, unless an error occurs.
927
928 Use \helpref{LastCount}{wxsocketbaselastcount} to verify the number of bytes actually written.
929
930 Use \helpref{Error}{wxsocketbaseerror} to determine if the operation succeeded.
931
932 \wxheading{Parameters}
933
934 \docparam{buffer}{Buffer with the data to be sent.}
935
936 \docparam{nbytes}{Number of bytes to send.}
937
938 \wxheading{Return value}
939
940 Returns a reference to the current object.
941
942 \wxheading{Remark/Warning}
943
944 wxSocketBase::WriteMsg will behave as if the {\bf wxSOCKET\_WAITALL} flag
945 was always set and it will always ignore the {\bf wxSOCKET\_NOWAIT} flag.
946 The exact behaviour of WriteMsg depends on the {\bf wxSOCKET\_BLOCK} flag.
947 For a detailed explanation, see \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags}.
948
949 \wxheading{See also}
950
951 \helpref{wxSocketBase::Error}{wxsocketbaseerror},
952 \helpref{wxSocketBase::LastError}{wxsocketbaselasterror},
953 \helpref{wxSocketBase::LastCount}{wxsocketbaselastcount},
954 \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags},
955 \helpref{wxSocketBase::ReadMsg}{wxsocketbasereadmsg}
956
957
958 % ---------------------------------------------------------------------------
959 % CLASS wxSocketClient
960 % ---------------------------------------------------------------------------
961
962 \section{\class{wxSocketClient}}\label{wxsocketclient}
963
964 \wxheading{Derived from}
965
966 \helpref{wxSocketBase}{wxsocketbase}
967
968 \wxheading{Include files}
969
970 <wx/socket.h>
971
972 % ---------------------------------------------------------------------------
973 % Members
974 % ---------------------------------------------------------------------------
975 %
976 % wxSocketClient
977 %
978 \membersection{wxSocketClient::wxSocketClient}
979
980 \func{}{wxSocketClient}{\param{wxSocketFlags}{ flags = wxSOCKET_NONE}}
981
982 Constructor.
983
984 \wxheading{Parameters}
985
986 \docparam{flags}{Socket flags (See \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags})}
987
988 %
989 % ~wxSocketClient
990 %
991 \membersection{wxSocketClient::\destruct{wxSocketClient}}
992
993 \func{}{\destruct{wxSocketClient}}{\void}
994
995 Destructor.
996
997 %
998 % Connect
999 %
1000 \membersection{wxSocketClient::Connect}\label{wxsocketclientconnect}
1001
1002 \func{bool}{Connect}{\param{wxSockAddress\&}{ address}, \param{bool}{ wait = TRUE}}
1003
1004 Connects to a server using the specified address.
1005
1006 If {\it wait} is TRUE, Connect will wait until the connection completes.
1007 {\bf Warning:} This will block the GUI.
1008
1009 If {\it wait} is FALSE, Connect will try to establish the connection and
1010 return immediately, without blocking the GUI. When used this way, even if
1011 Connect returns FALSE, the connection request can be completed later.
1012 To detect this, use \helpref{WaitOnConnect}{wxsocketclientwaitonconnect},
1013 or catch {\bf wxSOCKET\_CONNECTION} events (for successful establishment)
1014 and {\bf wxSOCKET\_LOST} events (for connection failure).
1015
1016 \wxheading{Parameters}
1017
1018 \docparam{address}{Address of the server.}
1019
1020 \docparam{wait}{If TRUE, waits for the connection to complete.}
1021
1022 \wxheading{Return value}
1023
1024 Returns TRUE if the connection is established and no error occurs.
1025
1026 If {\it wait} was TRUE, and Connect returns FALSE, an error occured
1027 and the connection failed.
1028
1029 If {\it wait} was FALSE, and Connect returns FALSE, you should still
1030 be prepared to handle the completion of this connection request, either
1031 with \helpref{WaitOnConnect}{wxsocketclientwaitonconnect} or by watching
1032 {\bf wxSOCKET\_CONNECTION} and {\bf wxSOCKET\_LOST} events.
1033
1034 \wxheading{See also}
1035
1036 \helpref{wxSocketClient::WaitOnConnect}{wxsocketclientwaitonconnect},
1037 \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify},
1038 \helpref{wxSocketBase::Notify}{wxsocketbasenotify}
1039
1040 %
1041 % WaitOnConnect
1042 %
1043 \membersection{wxSocketClient::WaitOnConnect}\label{wxsocketclientwaitonconnect}
1044
1045 \func{bool}{WaitOnConnect}{\param{long}{ seconds = -1}, \param{long}{ milliseconds = 0}}
1046
1047 Wait until a connection request completes, or until the specified timeout
1048 elapses. Use this function after issuing a call to \helpref{Connect}{wxsocketclientconnect}
1049 with {\it wait} set to FALSE.
1050
1051 \wxheading{Parameters}
1052
1053 \docparam{seconds}{Number of seconds to wait.
1054 If -1, it will wait for the default timeout,
1055 as set with \helpref{SetTimeout}{wxsocketbasesettimeout}.}
1056
1057 \docparam{millisecond}{Number of milliseconds to wait.}
1058
1059 \wxheading{Return value}
1060
1061 WaitOnConnect returns TRUE if the connection request completes. This
1062 does not necessarily mean that the connection was succesfully established;
1063 it might also happen that the connection was refused by the peer. Use
1064 \helpref{IsConnected}{wxsocketbaseisconnected} to distinguish between
1065 these two situations.
1066
1067 If the timeout elapses, WaitOnConnect returns FALSE.
1068
1069 These semantics allow code like this:
1070
1071 \begin{verbatim}
1072 // Issue the connection request
1073 client->Connect(addr, FALSE);
1074
1075 // Wait until the request completes or until we decide to give up
1076 bool waitmore = TRUE;
1077 while ( !client->WaitOnConnect(seconds, millis) && waitmore )
1078 {
1079 // possibly give some feedback to the user,
1080 // and update waitmore if needed.
1081 }
1082 bool success = client->IsConnected();
1083 \end{verbatim}
1084
1085 \wxheading{See also}
1086
1087 \helpref{wxSocketClient::Connect}{wxsocketclientconnect},
1088 \helpref{wxSocketBase::IsConnected}{wxsocketbaseisconnected}
1089
1090 % ---------------------------------------------------------------------------
1091 % CLASS: wxSocketEvent
1092 % ---------------------------------------------------------------------------
1093 \section{\class{wxSocketEvent}}\label{wxsocketevent}
1094
1095 This event class contains information about socket events.
1096
1097 \wxheading{Derived from}
1098
1099 \helpref{wxEvent}{wxevent}
1100
1101 \wxheading{Include files}
1102
1103 <wx/socket.h>
1104
1105 \wxheading{Event table macros}
1106
1107 To process a socket event, use these event handler macros to direct input to member
1108 functions that take a wxSocketEvent argument.
1109
1110 \twocolwidtha{7cm}
1111 \begin{twocollist}\itemsep=0pt
1112 \twocolitem{{\bf EVT\_SOCKET(id, func)}}{Process a socket event, supplying the member function.}
1113 \end{twocollist}
1114
1115 \wxheading{See also}
1116
1117 \helpref{wxSocketBase}{wxsocketbase},
1118 \helpref{wxSocketClient}{wxsocketclient},
1119 \helpref{wxSocketServer}{wxsocketserver}
1120
1121 \latexignore{\rtfignore{\wxheading{Members}}}
1122
1123 \membersection{wxSocketEvent::wxSocketEvent}
1124
1125 \func{}{wxSocketEvent}{\param{int}{ id = 0}}
1126
1127 Constructor.
1128
1129 \membersection{wxSocketEvent::GetSocket}\label{wxsocketeventgetsocket}
1130
1131 \constfunc{wxSocketBase *}{GetSocket}{\void}
1132
1133 Returns the socket object to which this event refers to. This makes
1134 it possible to use the same event handler for different sockets.
1135
1136 \membersection{wxSocketEvent::GetSocketEvent}\label{wxsocketeventgetsocketevent}
1137
1138 \constfunc{wxSocketNotify}{GetSocketEvent}{\void}
1139
1140 Returns the socket event type.
1141
1142 % ---------------------------------------------------------------------------
1143 % CLASS: wxSocketServer
1144 % ---------------------------------------------------------------------------
1145 \section{\class{wxSocketServer}}\label{wxsocketserver}
1146
1147 \wxheading{Derived from}
1148
1149 \helpref{wxSocketBase}{wxsocketbase}
1150
1151 \wxheading{Include files}
1152
1153 <wx/socket.h>
1154
1155 % ---------------------------------------------------------------------------
1156 % Members
1157 % ---------------------------------------------------------------------------
1158 \latexignore{\rtfignore{\wxheading{Members}}}
1159
1160 %
1161 % wxSocketServer
1162 %
1163 \membersection{wxSocketServer::wxSocketServer}\label{wxsocketserverconstr}
1164
1165 \func{}{wxSocketServer}{\param{wxSockAddress\&}{ address}, \param{wxSocketFlags}{ flags = wxSOCKET_NONE}}
1166
1167 Constructs a new server and tries to bind to the specified {\it address}.
1168 Before trying to accept new connections, test whether it succeeded with
1169 \helpref{wxSocketBase::Ok}{wxsocketbaseok}.
1170
1171 \wxheading{Parameters}
1172
1173 \docparam{address}{Specifies the local address for the server (e.g. port number).}
1174
1175 \docparam{flags}{Socket flags (See \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags})}
1176
1177 %
1178 % ~wxSocketServer
1179 %
1180 \membersection{wxSocketServer::\destruct{wxSocketServer}}
1181
1182 \func{}{\destruct{wxSocketServer}}{\void}
1183
1184 Destructor (it doesn't close the accepted connections).
1185
1186 %
1187 % Accept
1188 %
1189 \membersection{wxSocketServer::Accept}\label{wxsocketserveraccept}
1190
1191 \func{wxSocketBase *}{Accept}{\param{bool}{ wait = TRUE}}
1192
1193 Accepts an incoming connection request, and creates a new
1194 \helpref{wxSocketBase}{wxsocketbase} object which represents
1195 the server-side of the connection.
1196
1197 If {\it wait} is TRUE and there are no pending connections to be
1198 accepted, it will wait for the next incoming connection to arrive.
1199 {\bf Warning:} This will block the GUI.
1200
1201 If {\it wait} is FALSE, it will try to accept a pending connection
1202 if there is one, but it will always return immediately without blocking
1203 the GUI. If you want to use Accept in this way, you can either check for
1204 incoming connections with \helpref{WaitForAccept}{wxsocketserverwaitforaccept}
1205 or catch {\bf wxSOCKET\_CONNECTION} events, then call Accept once you know
1206 that there is an incoming connection waiting to be accepted.
1207
1208 \wxheading{Return value}
1209
1210 Returns an opened socket connection, or NULL if an error occured or
1211 if the {\it wait} parameter was FALSE and there were no pending
1212 connections.
1213
1214 \wxheading{See also}
1215
1216 \helpref{wxSocketServer::WaitForAccept}{wxsocketserverwaitforaccept},
1217 \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify},
1218 \helpref{wxSocketBase::Notify}{wxsocketbasenotify},
1219 \helpref{wxSocketServer::AcceptWith}{wxsocketserveracceptwith}
1220
1221 %
1222 % AcceptWith
1223 %
1224 \membersection{wxSocketServer::AcceptWith}\label{wxsocketserveracceptwith}
1225
1226 \func{bool}{AcceptWith}{\param{wxSocketBase\&}{ socket}, \param{bool}{ wait = TRUE}}
1227
1228 Accept an incoming connection using the specified socket object.
1229
1230 \wxheading{Parameters}
1231
1232 \docparam{socket}{Socket to be initialized}
1233
1234 \wxheading{Return value}
1235
1236 Returns TRUE on success, or FALSE if an error occured or if the
1237 {\it wait} parameter was FALSE and there were no pending
1238 connections.
1239
1240 \helpref{wxSocketServer::WaitForAccept}{wxsocketserverwaitforaccept},
1241 \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify},
1242 \helpref{wxSocketBase::Notify}{wxsocketbasenotify},
1243 \helpref{wxSocketServer::Accept}{wxsocketserveraccept} for a detailed explanation
1244
1245 %
1246 % WaitForAccept
1247 %
1248 \membersection{wxSocketServer::WaitForAccept}\label{wxsocketserverwaitforaccept}
1249
1250 \func{bool}{WaitForAccept}{\param{long}{ seconds = -1}, \param{long}{ millisecond = 0}}
1251
1252 This function waits for an incoming connection. Use it if you want to call
1253 \helpref{Accept}{wxsocketserveraccept} or \helpref{AcceptWith}{wxsocketserveracceptwith}
1254 with {\it wait} set to FALSE, to detect when an incoming connection is waiting
1255 to be accepted.
1256
1257 \wxheading{Parameters}
1258
1259 \docparam{seconds}{Number of seconds to wait.
1260 If -1, it will wait for the default timeout,
1261 as set with \helpref{SetTimeout}{wxsocketbasesettimeout}.}
1262
1263 \docparam{millisecond}{Number of milliseconds to wait.}
1264
1265 \wxheading{Return value}
1266
1267 Returns TRUE if an incoming connection arrived, FALSE if the timeout elapsed.
1268
1269 \wxheading{See also}
1270
1271 \helpref{wxSocketServer::Accept}{wxsocketserveraccept},
1272 \helpref{wxSocketServer::AcceptWith}{wxsocketserveracceptwith}
1273