]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/tcpconn.tex
Added AdvanceSelection, ShowWindowMenu and keyboard handling
[wxWidgets.git] / docs / latex / wx / tcpconn.tex
CommitLineData
e2a6f233
JS
1\section{\class{wxTCPConnection}}\label{wxtcpconnection}
2
3A wxTCPClient object represents the connection between a client and a server.
4It emulates a DDE-style protocol, but uses TCP/IP which is available on most platforms.
5
6A DDE-based implementation for Windows is available using \helpref{wxDDEConnection}{wxddeconnection}.
7
8A wxTCPConnection object can be created by making a connection using a\rtfsp
9\helpref{wxTCPClient}{wxtcpclient} object, or by the acceptance of a connection by a\rtfsp
10\helpref{wxTCPServer}{wxtcpserver} object. The bulk of a conversation is controlled by
11calling members in a {\bf wxTCPConnection} object or by overriding its
12members.
13
14An application should normally derive a new connection class from
15wxTCPConnection, in order to override the communication event handlers
16to do something interesting.
17
18\wxheading{Derived from}
19
20wxConnectionBase\\
21\helpref{wxObject}{wxobject}
22
954b8ae6
JS
23\wxheading{Include files}
24
25<wx/sckipc.h>
26
a7af285d
VZ
27\wxheading{Library}
28
29\helpref{wxNet}{librarieslist}
30
e2a6f233
JS
31\wxheading{Types}
32
33\index{wxIPCFormat}wxIPCFormat is defined as follows:
34
35\begin{verbatim}
36enum wxIPCFormat
37{
38 wxIPC_INVALID = 0,
39 wxIPC_TEXT = 1, /* CF_TEXT */
40 wxIPC_BITMAP = 2, /* CF_BITMAP */
41 wxIPC_METAFILE = 3, /* CF_METAFILEPICT */
42 wxIPC_SYLK = 4,
43 wxIPC_DIF = 5,
44 wxIPC_TIFF = 6,
45 wxIPC_OEMTEXT = 7, /* CF_OEMTEXT */
46 wxIPC_DIB = 8, /* CF_DIB */
47 wxIPC_PALETTE = 9,
48 wxIPC_PENDATA = 10,
49 wxIPC_RIFF = 11,
50 wxIPC_WAVE = 12,
51 wxIPC_UNICODETEXT = 13,
52 wxIPC_ENHMETAFILE = 14,
53 wxIPC_FILENAME = 15, /* CF_HDROP */
54 wxIPC_LOCALE = 16,
55 wxIPC_PRIVATE = 20
56};
57\end{verbatim}
58
59\wxheading{See also}
60
61\helpref{wxTCPClient}{wxtcpclient}, \helpref{wxTCPServer}{wxtcpserver}, \helpref{Interprocess communications overview}{ipcoverview}
62
63\latexignore{\rtfignore{\wxheading{Members}}}
64
f510b7b2 65\membersection{wxTCPConnection::wxTCPConnection}\label{wxtcpconnectionctor}
e2a6f233
JS
66
67\func{}{wxTCPConnection}{\void}
68
69\func{}{wxTCPConnection}{\param{char* }{buffer}, \param{int}{ size}}
70
71Constructs a connection object. If no user-defined connection object is
72to be derived from wxTCPConnection, then the constructor should not be
73called directly, since the default connection object will be provided on
74requesting (or accepting) a connection. However, if the user defines his
75or her own derived connection object, the \helpref{wxTCPServer::OnAcceptConnection}{wxtcpserveronacceptconnection}\rtfsp
76and/or \helpref{wxTCPClient::OnMakeConnection}{wxtcpclientonmakeconnection} members should be replaced by
77functions which construct the new connection object. If the arguments of
78the wxTCPConnection constructor are void, then a default buffer is
79associated with the connection. Otherwise, the programmer must provide a
80a buffer and size of the buffer for the connection object to use in
81transactions.
82
f510b7b2 83\membersection{wxTCPConnection::Advise}\label{wxtcpconnectionadvise}
e2a6f233 84
1e0f0a90 85\func{bool}{Advise}{\param{const wxString\& }{item}, \param{const char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}}
e2a6f233
JS
86
87Called by the server application to advise the client of a change in
88the data associated with the given item. Causes the client
b2cf617c 89connection's \helpref{wxTCPConnection::OnAdvise}{wxtcpconnectiononadvise}
cc81d32f 90member to be called. Returns true if successful.
e2a6f233 91
f510b7b2 92\membersection{wxTCPConnection::Execute}\label{wxtcpconnectionexecute}
e2a6f233
JS
93
94\func{bool}{Execute}{\param{char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}}
95
96Called by the client application to execute a command on the server. Can
97also be used to transfer arbitrary data to the server (similar
98to \helpref{wxTCPConnection::Poke}{wxtcpconnectionpoke} in that respect). Causes the
99server connection's \helpref{wxTCPConnection::OnExecute}{wxtcpconnectiononexecute} member to be
cc81d32f 100called. Returns true if successful.
e2a6f233 101
f510b7b2 102\membersection{wxTCPConnection::Disconnect}\label{wxtcpconnectiondisconnect}
e2a6f233
JS
103
104\func{bool}{Disconnect}{\void}
105
106Called by the client or server application to disconnect from the other
107program; it causes the \helpref{wxTCPConnection::OnDisconnect}{wxtcpconnectionondisconnect} message
108to be sent to the corresponding connection object in the other
109program. The default behaviour of {\bf OnDisconnect} is to delete the
110connection, but the calling application must explicitly delete its
cc81d32f 111side of the connection having called {\bf Disconnect}. Returns true if
e2a6f233
JS
112successful.
113
114\membersection{wxTCPConnection::OnAdvise}\label{wxtcpconnectiononadvise}
115
116\func{virtual bool}{OnAdvise}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}, \param{char* }{data}, \param{int}{ size}, \param{wxIPCFormat}{ format}}
117
118Message sent to the client application when the server notifies it of a
119change in the data associated with the given item.
120
121\membersection{wxTCPConnection::OnDisconnect}\label{wxtcpconnectionondisconnect}
122
123\func{virtual bool}{OnDisconnect}{\void}
124
125Message sent to the client or server application when the other
126application notifies it to delete the connection. Default behaviour is
127to delete the connection object.
128
129\membersection{wxTCPConnection::OnExecute}\label{wxtcpconnectiononexecute}
130
131\func{virtual bool}{OnExecute}{\param{const wxString\& }{topic}, \param{char* }{data}, \param{int}{ size}, \param{wxIPCFormat}{ format}}
132
133Message sent to the server application when the client notifies it to
134execute the given data. Note that there is no item associated with
135this message.
136
137\membersection{wxTCPConnection::OnPoke}\label{wxtcpconnectiononpoke}
138
139\func{virtual bool}{OnPoke}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}, \param{char* }{data}, \param{int}{ size}, \param{wxIPCFormat}{ format}}
140
141Message sent to the server application when the client notifies it to
142accept the given data.
143
144\membersection{wxTCPConnection::OnRequest}\label{wxtcpconnectiononrequest}
145
1e0f0a90 146\func{virtual const char*}{OnRequest}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}, \param{int *}{size}, \param{wxIPCFormat}{ format}}
e2a6f233
JS
147
148Message sent to the server application when the client
149calls \helpref{wxTCPConnection::Request}{wxtcpconnectionrequest}. The server
150should respond by returning a character string from {\bf OnRequest},
151or NULL to indicate no data.
152
153\membersection{wxTCPConnection::OnStartAdvise}\label{wxtcpconnectiononstartadvise}
154
155\func{virtual bool}{OnStartAdvise}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}}
156
157Message sent to the server application by the client, when the client
158wishes to start an `advise loop' for the given topic and item. The
cc81d32f 159server can refuse to participate by returning false.
e2a6f233
JS
160
161\membersection{wxTCPConnection::OnStopAdvise}\label{wxtcpconnectiononstopadvise}
162
163\func{virtual bool}{OnStopAdvise}{\param{const wxString\& }{topic}, \param{const wxString\& }{item}}
164
165Message sent to the server application by the client, when the client
166wishes to stop an `advise loop' for the given topic and item. The
cc81d32f 167server can refuse to stop the advise loop by returning false, although
e2a6f233
JS
168this doesn't have much meaning in practice.
169
170\membersection{wxTCPConnection::Poke}\label{wxtcpconnectionpoke}
171
1e0f0a90 172\func{bool}{Poke}{\param{const wxString\& }{item}, \param{const char* }{data}, \param{int}{ size = -1}, \param{wxIPCFormat}{ format = wxCF\_TEXT}}
e2a6f233
JS
173
174Called by the client application to poke data into the server. Can be
175used to transfer arbitrary data to the server. Causes the server
176connection's \helpref{wxTCPConnection::OnPoke}{wxtcpconnectiononpoke} member
cc81d32f 177to be called. Returns true if successful.
e2a6f233
JS
178
179\membersection{wxTCPConnection::Request}\label{wxtcpconnectionrequest}
180
181\func{char*}{Request}{\param{const wxString\& }{item}, \param{int *}{size}, \param{wxIPCFormat}{ format = wxIPC\_TEXT}}
182
183Called by the client application to request data from the server. Causes
184the server connection's \helpref{wxTCPConnection::OnRequest}{wxtcpconnectiononrequest} member to be called. Returns a
185character string (actually a pointer to the connection's buffer) if
186successful, NULL otherwise.
187
188\membersection{wxTCPConnection::StartAdvise}\label{wxtcpconnectionstartadvise}
189
190\func{bool}{StartAdvise}{\param{const wxString\& }{item}}
191
192Called by the client application to ask if an advise loop can be started
193with the server. Causes the server connection's \helpref{wxTCPConnection::OnStartAdvise}{wxtcpconnectiononstartadvise}\rtfsp
cc81d32f 194member to be called. Returns true if the server okays it, false
e2a6f233
JS
195otherwise.
196
197\membersection{wxTCPConnection::StopAdvise}\label{wxtcpconnectionstopadvise}
198
199\func{bool}{StopAdvise}{\param{const wxString\& }{item}}
200
201Called by the client application to ask if an advise loop can be
202stopped. Causes the server connection's \helpref{wxTCPConnection::OnStopAdvise}{wxtcpconnectiononstopadvise} member
cc81d32f 203to be called. Returns true if the server okays it, false otherwise.
e2a6f233 204