contents up previous next

wxtcpclient

a wxtcpclient object represents the client part of a client-server conversation. it emulates a dde-style protocol, but uses tcp/ip which is available on most platforms.

a dde-based implementation for windows is available using wxddeclient.

to create a client which can communicate with a suitable server, you need to derive a class from wxtcpconnection and another from wxtcpclient. the custom wxtcpconnection class will intercept communications in a 'conversation' with a server, and the custom wxtcpserver is required so that a user-overridden wxtcpclient::onmakeconnection member can return a wxtcpconnection of the required class, when a connection is made.

derived from

wxclientbase
wxobject

include files

<wx/sckipc.h>

see also

wxtcpserver, wxtcpconnection, interprocess communications overview

members

wxtcpclient::wxtcpclient
wxtcpclient::makeconnection
wxtcpclient::onmakeconnection
wxtcpclient::validhost


wxtcpclient::wxtcpclient

wxtcpclient()

constructs a client object.


wxtcpclient::makeconnection

wxconnectionbase * makeconnection(const wxstring& host, const wxstring& service, const wxstring& topic)

tries to make a connection with a server specified by the host (a machine name under unix), service name (must contain an integer port number under unix), and a topic string. if the server allows a connection, a wxtcpconnection object will be returned. the type of wxtcpconnection returned can be altered by overriding the wxtcpclient::onmakeconnection member to return your own derived connection object.


wxtcpclient::onmakeconnection

wxconnectionbase * onmakeconnection()

the type of wxtcpconnection returned from a wxtcpclient::makeconnection call can be altered by deriving the onmakeconnection member to return your own derived connection object. by default, a wxtcpconnection 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 wxtcpconnection::onadvise. you may also want to store application-specific data in instances of the new class.


wxtcpclient::validhost

bool validhost(const wxstring& host)

returns true if this is a valid host name, false otherwise.