]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/socksrv.tex
documentation for window ids allocation and wxIdManager (patch 1870570)
[wxWidgets.git] / docs / latex / wx / socksrv.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: socket.tex
3 %% Purpose: wxSocket docs
4 %% Author: Guillermo Rodriguez Garcia <guille@iies.es>
5 %% Modified by:
6 %% Created: 14.01.02 (extracted from socket.tex)
7 %% RCS-ID: $Id$
8 %% Copyright: (c) wxWidgets team
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12 % ---------------------------------------------------------------------------
13 % CLASS: wxSocketServer
14 % ---------------------------------------------------------------------------
15 \section{\class{wxSocketServer}}\label{wxsocketserver}
16
17 \wxheading{Derived from}
18
19 \helpref{wxSocketBase}{wxsocketbase}\\
20 \helpref{wxObject}{wxobject}
21
22 \wxheading{Include files}
23
24 <wx/socket.h>
25
26 \wxheading{Library}
27
28 \helpref{wxNet}{librarieslist}
29
30 % ---------------------------------------------------------------------------
31 % Members
32 % ---------------------------------------------------------------------------
33 \latexignore{\rtfignore{\wxheading{Members}}}
34
35 %
36 % wxSocketServer
37 %
38 \membersection{wxSocketServer::wxSocketServer}\label{wxsocketserverctor}
39
40 \func{}{wxSocketServer}{\param{const wxSockAddress\&}{ address}, \param{wxSocketFlags}{ flags = wxSOCKET\_NONE}}
41
42 Constructs a new server and tries to bind to the specified {\it address}.
43 Before trying to accept new connections, test whether it succeeded with
44 \helpref{wxSocketBase:IsOk}{wxsocketbaseisok}.
45
46 \wxheading{Parameters}
47
48 \docparam{address}{Specifies the local address for the server (e.g. port number).}
49
50 \docparam{flags}{Socket flags (See \helpref{wxSocketBase::SetFlags}{wxsocketbasesetflags})}
51
52 %
53 % ~wxSocketServer
54 %
55 \membersection{wxSocketServer::\destruct{wxSocketServer}}\label{wxsocketserverdtor}
56
57 \func{}{\destruct{wxSocketServer}}{\void}
58
59 Destructor (it doesn't close the accepted connections).
60
61 %
62 % Accept
63 %
64 \membersection{wxSocketServer::Accept}\label{wxsocketserveraccept}
65
66 \func{wxSocketBase *}{Accept}{\param{bool}{ wait = true}}
67
68 Accepts an incoming connection request, and creates a new
69 \helpref{wxSocketBase}{wxsocketbase} object which represents
70 the server-side of the connection.
71
72 If {\it wait} is true and there are no pending connections to be
73 accepted, it will wait for the next incoming connection to
74 arrive. {\bf Warning:} This will block the GUI.
75
76 If {\it wait} is false, it will try to accept a pending connection
77 if there is one, but it will always return immediately without blocking
78 the GUI. If you want to use Accept in this way, you can either check for
79 incoming connections with \helpref{WaitForAccept}{wxsocketserverwaitforaccept}
80 or catch {\bf wxSOCKET\_CONNECTION} events, then call Accept once you know
81 that there is an incoming connection waiting to be accepted.
82
83 \wxheading{Return value}
84
85 Returns an opened socket connection, or NULL if an error occurred or
86 if the {\it wait} parameter was false and there were no pending
87 connections.
88
89 \wxheading{See also}
90
91 \helpref{wxSocketServer::WaitForAccept}{wxsocketserverwaitforaccept},
92 \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify},
93 \helpref{wxSocketBase::Notify}{wxsocketbasenotify},
94 \helpref{wxSocketServer::AcceptWith}{wxsocketserveracceptwith}
95
96 %
97 % AcceptWith
98 %
99 \membersection{wxSocketServer::AcceptWith}\label{wxsocketserveracceptwith}
100
101 \func{bool}{AcceptWith}{\param{wxSocketBase\&}{ socket}, \param{bool}{ wait = true}}
102
103 Accept an incoming connection using the specified socket object.
104
105 \wxheading{Parameters}
106
107 \docparam{socket}{Socket to be initialized}
108
109 \wxheading{Return value}
110
111 Returns true on success, or false if an error occurred or if the
112 {\it wait} parameter was false and there were no pending
113 connections.
114
115 \helpref{wxSocketServer::WaitForAccept}{wxsocketserverwaitforaccept},
116 \helpref{wxSocketBase::SetNotify}{wxsocketbasesetnotify},
117 \helpref{wxSocketBase::Notify}{wxsocketbasenotify},
118 \helpref{wxSocketServer::Accept}{wxsocketserveraccept}
119
120 %
121 % WaitForAccept
122 %
123 \membersection{wxSocketServer::WaitForAccept}\label{wxsocketserverwaitforaccept}
124
125 \func{bool}{WaitForAccept}{\param{long}{ seconds = -1}, \param{long}{ millisecond = 0}}
126
127 This function waits for an incoming connection. Use it if you want to call
128 \helpref{Accept}{wxsocketserveraccept} or \helpref{AcceptWith}{wxsocketserveracceptwith}
129 with {\it wait} set to false, to detect when an incoming connection is waiting
130 to be accepted.
131
132 \wxheading{Parameters}
133
134 \docparam{seconds}{Number of seconds to wait.
135 If -1, it will wait for the default timeout,
136 as set with \helpref{SetTimeout}{wxsocketbasesettimeout}.}
137
138 \docparam{millisecond}{Number of milliseconds to wait.}
139
140 \wxheading{Return value}
141
142 Returns true if an incoming connection arrived, false if the timeout elapsed.
143
144 \wxheading{See also}
145
146 \helpref{wxSocketServer::Accept}{wxsocketserveraccept},
147 \helpref{wxSocketServer::AcceptWith}{wxsocketserveracceptwith},
148 \helpref{wxSocketBase::InterruptWait}{wxsocketbaseinterruptwait}
149
150