wxWidgets/docs/latex/wx/ddeservr.tex
Julian Smart f010ad4812 Applied patch [ 600051 ] DDE and TCP improvements and fixes
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
2002-09-01 14:48:16 +00:00

52 lines
1.7 KiB
TeX

\section{\class{wxDDEServer}}\label{wxddeserver}
A wxDDEServer object represents the server part of a client-server DDE
(Dynamic Data Exchange) conversation.
This DDE-based implementation is
available on Windows only, but a platform-independent, socket-based version
of this API is available using \helpref{wxTCPServer}{wxtcpserver}.
\wxheading{Derived from}
wxServerBase
\wxheading{Include files}
<wx/dde.h>
\wxheading{See also}
\helpref{wxDDEClient}{wxddeclient}, \helpref{wxDDEConnection}{wxddeconnection}, \helpref{IPC overview}{ipcoverview}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxDDEServer::wxDDEServer}
\func{}{wxDDEServer}{\void}
Constructs a server object.
\membersection{wxDDEServer::Create}
\func{bool}{Create}{\param{const wxString\& }{service}}
Registers the server using the given service name. Under UNIX, the
string must contain an integer id which is used as an Internet port
number. FALSE is returned if the call failed (for example, the port
number is already in use).
\membersection{wxDDEServer::OnAcceptConnection}\label{wxddeserveronacceptconnection}
\func{virtual wxConnectionBase *}{OnAcceptConnection}{\param{const wxString\& }{topic}}
When a client calls {\bf MakeConnection}, the server receives the
message and this member is called. The application should derive a
member to intercept this message and return a connection object of
either the standard wxDDEConnection type, or of a user-derived type. If the
topic is ``STDIO'', the application may wish to refuse the connection.
Under UNIX, when a server is created the OnAcceptConnection message is
always sent for standard input and output, but in the context of DDE
messages it doesn't make a lot of sense.