1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
<HTML>
<head><title>wxTCPClient</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxtcpclient"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx235.htm#wxtaskbaricon"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx237.htm#wxtcpconnection"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxTCPClient</H2>
<P>
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.<P>
A DDE-based implementation for Windows is available using <A HREF="wx66.htm#wxddeclient">wxDDEClient</A>.<P>
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-overriden <A HREF="wx236.htm#wxtcpclientonmakeconnection">wxTCPClient::OnMakeConnection</A> member can return
a wxTCPConnection of the required class, when a connection is made.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
wxClientBase<BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/sckipc.h><P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx238.htm#wxtcpserver">wxTCPServer</A>, <A HREF="wx237.htm#wxtcpconnection">wxTCPConnection</A>,
<A HREF="wx301.htm#ipcoverview">Interprocess communications overview</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#topic964">wxTCPClient::wxTCPClient</A><BR>
<A HREF="#wxtcpclientmakeconnection">wxTCPClient::MakeConnection</A><BR>
<A HREF="#wxtcpclientonmakeconnection">wxTCPClient::OnMakeConnection</A><BR>
<A HREF="#topic965">wxTCPClient::ValidHost</A><BR>
<P>
<HR>
<A NAME="topic964"></A>
<H3>wxTCPClient::wxTCPClient</H3>
<P>
<B></B> <B>wxTCPClient</B>()<P>
Constructs a client object.<P>
<HR>
<A NAME="wxtcpclientmakeconnection"></A>
<H3>wxTCPClient::MakeConnection</H3>
<P>
<B>wxConnectionBase *</B> <B>MakeConnection</B>(<B>const wxString& </B><I>host</I>, <B>const wxString& </B><I>service</I>, <B>const wxString& </B><I>topic</I>)<P>
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 <A HREF="wx236.htm#wxtcpclientonmakeconnection">wxTCPClient::OnMakeConnection</A> member to return your own
derived connection object.<P>
<HR>
<A NAME="wxtcpclientonmakeconnection"></A>
<H3>wxTCPClient::OnMakeConnection</H3>
<P>
<B>wxConnectionBase *</B> <B>OnMakeConnection</B>()<P>
The type of <A HREF="wx237.htm#wxtcpconnection">wxTCPConnection</A> returned from a <A HREF="wx236.htm#wxtcpclientmakeconnection">wxTCPClient::MakeConnection</A> call can
be altered by deriving the <B>OnMakeConnection</B> member to return your
own derived connection object. By default, a wxTCPConnection
object is returned.<P>
The advantage of deriving your own connection class is that it will
enable you to intercept messages initiated by the server, such
as <A HREF="wx237.htm#wxtcpconnectiononadvise">wxTCPConnection::OnAdvise</A>. You may also want to
store application-specific data in instances of the new class.<P>
<HR>
<A NAME="topic965"></A>
<H3>wxTCPClient::ValidHost</H3>
<P>
<B>bool</B> <B>ValidHost</B>(<B>const wxString& </B><I>host</I>)<P>
Returns TRUE if this is a valid host name, FALSE otherwise.<P>
</BODY></HTML>
|