]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/socksrv.tex
Robert Lang's patch [ 1583183 ] Fixes printing/print preview inconsistencies
[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
25% ---------------------------------------------------------------------------
26% Members
27% ---------------------------------------------------------------------------
28\latexignore{\rtfignore{\wxheading{Members}}}
29
30%
31% wxSocketServer
32%
39275175 33\membersection{wxSocketServer::wxSocketServer}\label{wxsocketserverctor}
f3845e88 34
fbfb8bcc 35\func{}{wxSocketServer}{\param{const wxSockAddress\&}{ address}, \param{wxSocketFlags}{ flags = wxSOCKET\_NONE}}
f3845e88
VZ
36
37Constructs a new server and tries to bind to the specified {\it address}.
38Before trying to accept new connections, test whether it succeeded with
b7cacb43 39\helpref{wxSocketBase:IsOk}{wxsocketbaseisok}.
f3845e88
VZ
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%
39275175 50\membersection{wxSocketServer::\destruct{wxSocketServer}}\label{wxsocketserverdtor}
f3845e88
VZ
51
52\func{}{\destruct{wxSocketServer}}{\void}
53
54Destructor (it doesn't close the accepted connections).
55
56%
57% Accept
58%
59\membersection{wxSocketServer::Accept}\label{wxsocketserveraccept}
60
cc81d32f 61\func{wxSocketBase *}{Accept}{\param{bool}{ wait = true}}
f3845e88
VZ
62
63Accepts an incoming connection request, and creates a new
64\helpref{wxSocketBase}{wxsocketbase} object which represents
65the server-side of the connection.
66
cc81d32f 67If {\it wait} is true and there are no pending connections to be
f3845e88
VZ
68accepted, it will wait for the next incoming connection to
69arrive. {\bf Warning:} This will block the GUI.
70
cc81d32f 71If {\it wait} is false, it will try to accept a pending connection
f3845e88
VZ
72if there is one, but it will always return immediately without blocking
73the GUI. If you want to use Accept in this way, you can either check for
74incoming connections with \helpref{WaitForAccept}{wxsocketserverwaitforaccept}
75or catch {\bf wxSOCKET\_CONNECTION} events, then call Accept once you know
76that there is an incoming connection waiting to be accepted.
77
78\wxheading{Return value}
79
80Returns an opened socket connection, or NULL if an error occurred or
cc81d32f 81if the {\it wait} parameter was false and there were no pending
f3845e88
VZ
82connections.
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
cc81d32f 96\func{bool}{AcceptWith}{\param{wxSocketBase\&}{ socket}, \param{bool}{ wait = true}}
f3845e88
VZ
97
98Accept 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
cc81d32f
VS
106Returns true on success, or false if an error occurred or if the
107{\it wait} parameter was false and there were no pending
f3845e88
VZ
108connections.
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
122This function waits for an incoming connection. Use it if you want to call
123\helpref{Accept}{wxsocketserveraccept} or \helpref{AcceptWith}{wxsocketserveracceptwith}
cc81d32f 124with {\it wait} set to false, to detect when an incoming connection is waiting
f3845e88
VZ
125to be accepted.
126
127\wxheading{Parameters}
128
129\docparam{seconds}{Number of seconds to wait.
130If -1, it will wait for the default timeout,
131as set with \helpref{SetTimeout}{wxsocketbasesettimeout}.}
132
133\docparam{millisecond}{Number of milliseconds to wait.}
134
135\wxheading{Return value}
136
cc81d32f 137Returns true if an incoming connection arrived, false if the timeout elapsed.
f3845e88
VZ
138
139\wxheading{See also}
140
141\helpref{wxSocketServer::Accept}{wxsocketserveraccept},
142\helpref{wxSocketServer::AcceptWith}{wxsocketserveracceptwith},
143\helpref{wxSocketBase::InterruptWait}{wxsocketbaseinterruptwait}
144
145