f010ad4812
By Michael Fielding As discussed on wx-dev. some fixes and improvements for Interprocess Communication (IPC), using DDE and TCP. 1. DDE buffers were using a global buffer 2. TCP buffers were allocated each time needed, and Request would have caused memory leaks had it been used. Fixed these both by using a self-resizing buffer in wxConnectionBase. Changed samples and docs to reflect the improved (but backward compatible) internal buffer management. wxConnectionBase could (in future) use wxMemoryBuffer. 3. IPC sample had trouble closing, causing crash, when closing server using window X button. Because it was (effectively) trying to delete a window in OnExit, when that window was already destroyed. Fixed by making IPCDialog and MyConnection remember if they'd destroyed each other. It's not elegant, but either the connection or the window could be deleted first. 4. Docs for wxDDE... and wxTCP... duplicated eachother, supposed to have same API. Some parts unclear. Patch removes dde and tcp-specific files (including from tipc.tex and classes.tex), and explains how ipc.h selects for you which one to use based on platform. Some other misc clarifications. 6. Client sample was suffering apparent memory leak because of not deleting connection object, and had a hack in there to do that. In fact this was due to the derived OnDisconnect not deleting itself, as it does in base class. Mentioned need to do it in docs, fixed sample so that it does. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16907 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
72 lines
2.8 KiB
TeX
72 lines
2.8 KiB
TeX
\section{\class{wxDDEClient}}\label{wxddeclient}
|
|
|
|
A wxDDEClient object represents the client part of a client-server DDE
|
|
(Dynamic Data Exchange) conversation.
|
|
|
|
To create a client which can communicate with a suitable server,
|
|
you need to derive a class from wxDDEConnection and another from wxDDEClient.
|
|
The custom wxDDEConnection class will intercept communications in
|
|
a `conversation' with a server, and the custom wxDDEServer is required
|
|
so that a user-overridden \helpref{wxDDEClient::OnMakeConnection}{wxddeclientonmakeconnection} member can return
|
|
a wxDDEConnection of the required class, when a connection is made.
|
|
|
|
This DDE-based implementation is
|
|
available on Windows only, but a platform-independent, socket-based version
|
|
of this API is available using \helpref{wxTCPClient}{wxtcpclient}.
|
|
|
|
\wxheading{Derived from}
|
|
|
|
wxClientBase\\
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
\wxheading{Include files}
|
|
|
|
<wx/dde.h>
|
|
|
|
\wxheading{See also}
|
|
|
|
\helpref{wxDDEServer}{wxddeserver}, \helpref{wxDDEConnection}{wxddeconnection},
|
|
\helpref{Interprocess communications overview}{ipcoverview}
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
\membersection{wxDDEClient::wxDDEClient}
|
|
|
|
\func{}{wxDDEClient}{\void}
|
|
|
|
Constructs a client object.
|
|
|
|
\membersection{wxDDEClient::MakeConnection}\label{wxddeclientmakeconnection}
|
|
|
|
\func{wxConnectionBase *}{MakeConnection}{\param{const wxString\& }{host}, \param{const wxString\& }{service}, \param{const wxString\& }{topic}}
|
|
|
|
Tries to make a connection with a server specified by the host
|
|
(machine name under UNIX, ignored under Windows), service name (must
|
|
contain an integer port number under UNIX), and topic string. If the
|
|
server allows a connection, a wxDDEConnection object will be returned.
|
|
The type of wxDDEConnection returned can be altered by overriding
|
|
the \helpref{wxDDEClient::OnMakeConnection}{wxddeclientonmakeconnection} member to return your own
|
|
derived connection object.
|
|
|
|
\membersection{wxDDEClient::OnMakeConnection}\label{wxddeclientonmakeconnection}
|
|
|
|
\func{wxConnectionBase *}{OnMakeConnection}{\void}
|
|
|
|
The type of \helpref{wxDDEConnection}{wxddeconnection} returned from a \helpref{wxDDEClient::MakeConnection}{wxddeclientmakeconnection} call can
|
|
be altered by deriving the {\bf OnMakeConnection} member to return your
|
|
own derived connection object. By default, a wxDDEConnection
|
|
object is returned.
|
|
|
|
The advantage of deriving your own connection class is that it will
|
|
enable you to intercept messages initiated by the server, such
|
|
as \helpref{wxDDEConnection::OnAdvise}{wxddeconnectiononadvise}. You may also want to
|
|
store application-specific data in instances of the new class.
|
|
|
|
\membersection{wxDDEClient::ValidHost}
|
|
|
|
\func{bool}{ValidHost}{\param{const wxString\& }{host}}
|
|
|
|
Returns TRUE if this is a valid host name, FALSE otherwise. This always
|
|
returns TRUE under MS Windows.
|
|
|