]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/socksrv.tex
typo fix
[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
21 \wxheading{Include files}
22
23 <wx/socket.h>
24
25 \wxheading{Library}
26
27 \helpref{wxNet}{librarieslist}
28
29 % ---------------------------------------------------------------------------
30 % Members
31 % ---------------------------------------------------------------------------
32 \latexignore{\rtfignore{\wxheading{Members}}}
33
34 %
35 % wxSocketServer
36 %
37 \membersection{wxSocketServer::wxSocketServer}\label{wxsocketserverctor}
38
39 \func{}{wxSocketServer}{\param{const wxSockAddress\&}{ address}, \param{wxSocketFlags}{ flags = wxSOCKET\_NONE}}
40
41 Constructs a new server and tries to bind to the specified {\it address}.
42 Before trying to accept new connections, test whether it succeeded with
43 \helpref{wxSocketBase:IsOk}{wxsocketbaseisok}.
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 %
54 \membersection{wxSocketServer::\destruct{wxSocketServer}}\label{wxsocketserverdtor}
55
56 \func{}{\destruct{wxSocketServer}}{\void}
57
58 Destructor (it doesn't close the accepted connections).
59
60 %
61 % Accept
62 %
63 \membersection{wxSocketServer::Accept}\label{wxsocketserveraccept}
64
65 \func{wxSocketBase *}{Accept}{\param{bool}{ wait = true}}
66
67 Accepts an incoming connection request, and creates a new
68 \helpref{wxSocketBase}{wxsocketbase} object which represents
69 the server-side of the connection.
70
71 If {\it wait} is true and there are no pending connections to be
72 accepted, it will wait for the next incoming connection to
73 arrive. {\bf Warning:} This will block the GUI.
74
75 If {\it wait} is false, it will try to accept a pending connection
76 if there is one, but it will always return immediately without blocking
77 the GUI. If you want to use Accept in this way, you can either check for
78 incoming connections with \helpref{WaitForAccept}{wxsocketserverwaitforaccept}
79 or catch {\bf wxSOCKET\_CONNECTION} events, then call Accept once you know
80 that there is an incoming connection waiting to be accepted.
81
82 \wxheading{Return value}
83
84 Returns an opened socket connection, or NULL if an error occurred or
85 if the {\it wait} parameter was false and there were no pending
86 connections.
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
100 \func{bool}{AcceptWith}{\param{wxSocketBase\&}{ socket}, \param{bool}{ wait = true}}
101
102 Accept 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
110 Returns true on success, or false if an error occurred or if the
111 {\it wait} parameter was false and there were no pending
112 connections.
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
126 This function waits for an incoming connection. Use it if you want to call
127 \helpref{Accept}{wxsocketserveraccept} or \helpref{AcceptWith}{wxsocketserveracceptwith}
128 with {\it wait} set to false, to detect when an incoming connection is waiting
129 to be accepted.
130
131 \wxheading{Parameters}
132
133 \docparam{seconds}{Number of seconds to wait.
134 If -1, it will wait for the default timeout,
135 as set with \helpref{SetTimeout}{wxsocketbasesettimeout}.}
136
137 \docparam{millisecond}{Number of milliseconds to wait.}
138
139 \wxheading{Return value}
140
141 Returns true if an incoming connection arrived, false if the timeout elapsed.
142
143 \wxheading{See also}
144
145 \helpref{wxSocketServer::Accept}{wxsocketserveraccept},
146 \helpref{wxSocketServer::AcceptWith}{wxsocketserveracceptwith},
147 \helpref{wxSocketBase::InterruptWait}{wxsocketbaseinterruptwait}
148
149