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