|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |
#include "ot/net/TcpNetworkClient.h"
Method Summary | |
virtual void |
connect(const String& host, int port, size_t timeoutMS) Connects this TcpNetworkClient to a server on the specified host. |
protected virtual RefPtr< Socket > |
createConnection(const String& host, int port, size_t timeoutMS) Protected virtual method to create a Socket connection to the TCP/IP network server. |
virtual void |
disconnect() Disconnects from the server. |
protected virtual int |
getDefaultPort() const=0 Virtual member function overridden in derived classes to return a default port number for the network service. |
virtual RefPtr< InputStream > |
getInputStream() const Returns an InputStream for reading from the server. |
virtual RefPtr< InetAddress > |
getLocalAddress() const Returns the local IP Address that the connected socket is bound to. |
virtual RefPtr< OutputStream > |
getOutputStream() const Returns an OutputStream for writing to the server. |
virtual RefPtr< InetAddress > |
getServerAddress() const Returns the IP Address of the remote server to which this TcpNetworkClient is connected. |
virtual int |
getServerPort() const Returns the port number of the remote server to which this TcpNetworkClient is connected. |
virtual bool |
isConnected() const Tests if this TcpNetworkClient is currently connected to a server. |
protected virtual void |
postConnect(const String& server, int port, size_t timeoutMS) Protected function called when a socket connection has been established with the TCP/IP network server. |
protected virtual void |
preDisconnect() Protected function called when a socket connection is about to be closed from the client side. |
Methods inherited from class ot::ManagedObject |
addRef, getRefCount, onFinalRelease, operator=, release |
Method Detail |
virtual void connect(const String& host, int port, size_t timeoutMS)
If timeoutMS is specified and is greater than zero, the connection attempt will time-out and a SocketTimeoutException will be thrown if the specified number of milliseconds elapses before the connection is fully established.
If port is less than or equal to zero (the default), then a default port number will be obtained by calling getDefaultPort().
host
- port
- timeoutMS
- IOException
- ProtocolException
- UnknownHostException
- SocketTimeoutException
- protected virtual RefPtr< Socket > createConnection(const String& host, int port, size_t timeoutMS)
host
- port
- timeoutMS
- IOException
- UnknownHostException
- SocketTimeoutException
- virtual void disconnect()
Further calls to disconnect() have no effect.
protected virtual int getDefaultPort() const=0
virtual RefPtr< InputStream > getInputStream() const
virtual RefPtr< InetAddress > getLocalAddress() const
virtual RefPtr< OutputStream > getOutputStream() const
virtual RefPtr< InetAddress > getServerAddress() const
virtual int getServerPort() const
virtual bool isConnected() const
protected virtual void postConnect(const String& server, int port, size_t timeoutMS)
server
- port
- timeoutMS
- protected virtual void preDisconnect()
|
OpenTop 1.3 | |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | Cross-Platform C++ | ||||
SUMMARY: CONSTRUCTOR | METHOD | DETAIL: CONSTRUCTOR | METHOD |