GizmoDistribution

gzDistTransportTCP Class Reference

TCP transport class. More...

#include <gzDistTransport.h>

Inheritance diagram for gzDistTransportTCP:

gzDistTransportInterface List of all members.

Public Member Functions

 gzDistTransportTCP (gzULong sendBuffer=GZ_DIST_DEFAULT_SEND_SOCKET_BUFFER, gzULong recvBuffer=GZ_DIST_DEFAULT_RECV_SOCKET_BUFFER)
 Constructor.
virtual ~gzDistTransportTCP ()
 Destructor.
gzBool createClient (const gzSocketAddress &remoteAddress)
 Setup TCP client.
gzBool createClient (gzSocket *connection)
 Setup TCP client.
gzBool createServer (gzUShort listenPort, const gzHostAddress &interfaceAddress=gzHostAddress(0, 0, 0, 0))
 Setup TCP server.
gzBool open ()
 Open transport.
gzVoid close ()
 Close transport.
gzBool isOpen () const
 Check if this transport is open.
gzBool isConnected ()
 Check if this transport is connected.
gzBool isServer () const
 Check if this is a TCP server or a TCP client.
gzBool send (const gzUByte *buffer, gzULong length)
 Send message.
gzInt receive (gzUByte *buffer, gzULong length, gzULong timeout=0)
 Receive message.
gzSocketAddress getClientConnectAddress ()
 Get the remote address the transport is connected to.
gzSocketAddress getServerListenAddress ()
 Get the local address the server is listening on.

Detailed Description

TCP transport class.

Transport using TCP/IP. Includes supports for both server and client connections. The server can accept only one connection at a time.

See also:
gzDistTransportInterface
Examples:

tcp.cpp.

Definition at line 205 of file gzDistTransport.h.


Constructor & Destructor Documentation

gzDistTransportTCP::gzDistTransportTCP gzULong  sendBuffer = GZ_DIST_DEFAULT_SEND_SOCKET_BUFFER,
gzULong  recvBuffer = GZ_DIST_DEFAULT_RECV_SOCKET_BUFFER
 

Constructor.

Note:
The max allowed socket buffer size may be different on different platforms.
Parameters:
sendBuffer Size of the socket send buffer.
recvBuffer Size of the socket receive buffer.


Member Function Documentation

gzBool gzDistTransportTCP::createClient const gzSocketAddress &  remoteAddress  ) 
 

Setup TCP client.

Parameters:
remoteAddress The address that this transport will connect to.
Examples:
tcp.cpp.

gzBool gzDistTransportTCP::createClient gzSocket *  connection  ) 
 

Setup TCP client.

Parameters:
connection A connected client socket.

gzBool gzDistTransportTCP::createServer gzUShort  listenPort,
const gzHostAddress &  interfaceAddress = gzHostAddress(0, 0, 0, 0)
 

Setup TCP server.

Parameters:
listenPort The port that to accept connections on.
interfaceAddress The interface address to bind to.

gzBool gzDistTransportTCP::isOpen  )  const [virtual]
 

Check if this transport is open.

sa isConnected()

Implements gzDistTransportInterface.

gzBool gzDistTransportTCP::isConnected  )  [virtual]
 

Check if this transport is connected.

A TCP client is always connected when it is opened. A TCP server is only connected when a remote client has connected to its socket.

See also:
isOpen()

Implements gzDistTransportInterface.

Examples:
tcp.cpp.

gzSocketAddress gzDistTransportTCP::getClientConnectAddress  ) 
 

Get the remote address the transport is connected to.

Valid only when connected (for both clients and servers).

Examples:
tcp.cpp.

gzSocketAddress gzDistTransportTCP::getServerListenAddress  ) 
 

Get the local address the server is listening on.

Valid only for servers that are open.


The documentation for this class was generated from the following file:
Documentation for GizmoDistribution generated at Wed Feb 20 11:59:22 2008 by   Saab Training Systems AB, ¸ (c) 2003-and beyond