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