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