wxRuby Documentation Home

# Wx::Server

A Server object represents the server part of a client-server
DDE-like (Dynamic Data Exchange) conversation. The actual
DDE-based implementation using DDEServer is available on Windows
only, but a platform-independent, socket-based version of this
API is available using TCPServer, which has the same API.

To create a server which can communicate with a suitable client,
you need to derive a class from Connection and another from
Server. The custom Connection class will intercept
communications in a `conversation’ with a client, and the custom
Server is required so that a user-overridden Server#on_accept_connection
member can return a Connection of the required class, when a
connection is made. Look at the IPC sample and the Interprocess communications overview for
an example of how to do this.

## Derived from

ServerBase

## See also

Client,
Connection, IPC
overview

## Methods

- Server.new
- Server#create
- Server#on_accept_connection

### Server.new

### Server#create

Boolean create(%(arg-type)String% 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
created. false is returned if the call failed (for example, the
port number is already in use).

### Server#on_accept_connection

ConnectionBase on_accept_connection(%(arg-type)String% topic)

When a client calls 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 Connection type, or (more likely) 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.

[This page automatically generated from the Textile source at 2023-06-09 00:45:31 +0000]