2002-09-06 18:38:25 -04:00
|
|
|
\section{\class{wxServer}}\label{wxddeserver}
|
|
|
|
|
|
|
|
A wxServer object represents the server part of a client-server
|
|
|
|
DDE-like (Dynamic Data Exchange) conversation. The actual
|
|
|
|
DDE-based implementation using wxDDEServer is available on Windows
|
|
|
|
only, but a platform-independent, socket-based version of this
|
|
|
|
API is available using wxTCPServer, which has the same API.
|
|
|
|
|
|
|
|
To create a server which can communicate with a suitable client,
|
|
|
|
you need to derive a class from wxConnection and another from
|
|
|
|
wxServer. The custom wxConnection class will intercept
|
|
|
|
communications in a `conversation' with a client, and the custom
|
2004-09-24 06:57:56 -04:00
|
|
|
wxServer is required so that a user-overridden \helpref{wxServer::OnAcceptConnection}{wxserveronacceptconnection}
|
2002-09-06 18:38:25 -04:00
|
|
|
member can return a wxConnection of the required class, when a
|
|
|
|
connection is made. Look at the IPC sample and the \helpref{Interprocess communications overview}{ipcoverview} for
|
|
|
|
an example of how to do this.
|
|
|
|
|
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
wxServerBase
|
|
|
|
|
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/ipc.h>
|
|
|
|
|
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxClient}{wxddeclient},
|
|
|
|
\helpref{wxConnection}{wxddeconnection}, \helpref{IPC
|
|
|
|
overview}{ipcoverview}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-09-24 06:57:56 -04:00
|
|
|
\membersection{wxServer::wxServer}\label{wxserverctor}
|
2002-09-06 18:38:25 -04:00
|
|
|
|
|
|
|
\func{}{wxServer}{\void}
|
|
|
|
|
|
|
|
Constructs a server object.
|
|
|
|
|
2004-09-24 06:57:56 -04:00
|
|
|
\membersection{wxServer::Create}\label{wxservercreate}
|
2002-09-06 18:38:25 -04:00
|
|
|
|
|
|
|
\func{bool}{Create}{\param{const wxString\& }{service}}
|
|
|
|
|
|
|
|
Registers the server using the given service name. Under Unix,
|
|
|
|
the service name may be either an integer port identifier in
|
|
|
|
which case an Internet domain socket will be used for the
|
|
|
|
communications, or a valid file name (which shouldn't exist and
|
|
|
|
will be deleted afterwards) in which case a Unix domain socket is
|
2003-01-17 19:16:34 -05:00
|
|
|
created. false is returned if the call failed (for example, the
|
2002-09-06 18:38:25 -04:00
|
|
|
port number is already in use).
|
|
|
|
|
2004-09-24 06:57:56 -04:00
|
|
|
\membersection{wxServer::OnAcceptConnection}\label{wxserveronacceptconnection}
|
2002-09-06 18:38:25 -04:00
|
|
|
|
|
|
|
\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 wxConnection type, or (more likely) of a
|
|
|
|
user-derived type.
|
|
|
|
|
|
|
|
If the topic is {\bf 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.
|
|
|
|
|