]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/ipcservr.tex
added wxMessageQueue class for inter-thread communications
[wxWidgets.git] / docs / latex / wx / ipcservr.tex
1 \section{\class{wxServer}}\label{wxserver}
2
3 A wxServer object represents the server part of a client-server
4 DDE-like (Dynamic Data Exchange) conversation. The actual
5 DDE-based implementation using wxDDEServer is available on Windows
6 only, but a platform-independent, socket-based version of this
7 API is available using wxTCPServer, which has the same API.
8
9 To create a server which can communicate with a suitable client,
10 you need to derive a class from wxConnection and another from
11 wxServer. The custom wxConnection class will intercept
12 communications in a `conversation' with a client, and the custom
13 wxServer is required so that a user-overridden \helpref{wxServer::OnAcceptConnection}{wxserveronacceptconnection}
14 member can return a wxConnection of the required class, when a
15 connection is made. Look at the IPC sample and the \helpref{Interprocess communications overview}{ipcoverview} for
16 an example of how to do this.
17
18 \wxheading{Derived from}
19
20 wxServerBase
21
22 \wxheading{Include files}
23
24 <wx/ipc.h>
25
26 \wxheading{See also}
27
28 \helpref{wxClient}{wxclient},
29 \helpref{wxConnection}{wxddeconnection}, \helpref{IPC
30 overview}{ipcoverview}
31
32 \latexignore{\rtfignore{\wxheading{Members}}}
33
34 \membersection{wxServer::wxServer}\label{wxserverctor}
35
36 \func{}{wxServer}{\void}
37
38 Constructs a server object.
39
40 \membersection{wxServer::Create}\label{wxservercreate}
41
42 \func{bool}{Create}{\param{const wxString\& }{service}}
43
44 Registers the server using the given service name. Under Unix,
45 the service name may be either an integer port identifier in
46 which case an Internet domain socket will be used for the
47 communications, or a valid file name (which shouldn't exist and
48 will be deleted afterwards) in which case a Unix domain socket is
49 created. false is returned if the call failed (for example, the
50 port number is already in use).
51
52 \membersection{wxServer::OnAcceptConnection}\label{wxserveronacceptconnection}
53
54 \func{virtual wxConnectionBase *}{OnAcceptConnection}{\param{const wxString\& }{topic}}
55
56 When a client calls {\bf MakeConnection}, the server receives the
57 message and this member is called. The application should derive a
58 member to intercept this message and return a connection object of
59 either the standard wxConnection type, or (more likely) of a
60 user-derived type.
61
62 If the topic is {\bf STDIO}, the application may wish to refuse the
63 connection. Under UNIX, when a server is created the
64 OnAcceptConnection message is always sent for standard input and
65 output, but in the context of DDE messages it doesn't make a lot
66 of sense.
67