aboutsummaryrefslogtreecommitdiff
path: root/dep/include/sockets/StreamSocket.h
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-17 15:51:44 -0700
committermaximius <none@none>2009-10-17 15:51:44 -0700
commite585187b248f48b3c6e9247b49fa07c6565d65e5 (patch)
tree637c5b7ddacf41040bef4ea4f75a97da64c6a9bc /dep/include/sockets/StreamSocket.h
parent26b5e033ffde3d161382fc9addbfa99738379641 (diff)
*Backed out changeset 3be01fb200a5
--HG-- branch : trunk
Diffstat (limited to 'dep/include/sockets/StreamSocket.h')
-rw-r--r--dep/include/sockets/StreamSocket.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/dep/include/sockets/StreamSocket.h b/dep/include/sockets/StreamSocket.h
index 6abb936b6cd..e839040e2b0 100644
--- a/dep/include/sockets/StreamSocket.h
+++ b/dep/include/sockets/StreamSocket.h
@@ -1,11 +1,14 @@
#ifndef _StreamSocket_H
#define _StreamSocket_H
+
#include "Socket.h"
+
#ifdef SOCKETS_NAMESPACE
namespace SOCKETS_NAMESPACE {
#endif
+
/** SOCK_STREAM Socket base class.
\ingroup basic */
class StreamSocket : public Socket
@@ -13,70 +16,96 @@ class StreamSocket : public Socket
public:
StreamSocket(ISocketHandler& );
~StreamSocket();
+
/** Socket should Check Connect on next write event from select(). */
void SetConnecting(bool = true);
+
/** Check connecting flag.
\return true if the socket is still trying to connect */
bool Connecting();
+
/** Returns true when socket file descriptor is valid,
socket connection is established, and socket is not about to
be closed. */
bool Ready();
+
/** Set timeout to use for connection attempt.
\param x Timeout in seconds */
void SetConnectTimeout(int x);
+
/** Return number of seconds to wait for a connection.
\return Connection timeout (seconds) */
int GetConnectTimeout();
+
/** Set flush before close to make a tcp socket completely empty its
output buffer before closing the connection. */
void SetFlushBeforeClose(bool = true);
+
/** Check flush before status.
\return true if the socket should send all data before closing */
bool GetFlushBeforeClose();
+
/** Define number of connection retries (tcp only).
n = 0 - no retry
n > 0 - number of retries
n = -1 - unlimited retries */
void SetConnectionRetry(int n);
+
/** Get number of maximum connection retries (tcp only). */
int GetConnectionRetry();
+
/** Increase number of actual connection retries (tcp only). */
void IncreaseConnectionRetries();
+
/** Get number of actual connection retries (tcp only). */
int GetConnectionRetries();
+
/** Reset actual connection retries (tcp only). */
void ResetConnectionRetries();
+
// LIST_CALLONCONNECT
+
/** Instruct socket to call OnConnect callback next sockethandler cycle. */
void SetCallOnConnect(bool x = true);
+
/** Check call on connect flag.
\return true if OnConnect() should be called a.s.a.p */
bool CallOnConnect();
+
// LIST_RETRY
+
/** Set flag to initiate a connection attempt after a connection timeout. */
void SetRetryClientConnect(bool x = true);
+
/** Check if a connection attempt should be made.
\return true when another attempt should be made */
bool RetryClientConnect();
+
/** Called after OnRead if socket is in line protocol mode.
\sa SetLineProtocol */
/** Enable the OnLine callback. Do not create your own OnRead
* callback when using this. */
virtual void SetLineProtocol(bool = true);
+
/** Check line protocol mode.
\return true if socket is in line protocol mode */
bool LineProtocol();
+
/** Set shutdown status. */
void SetShutdown(int);
+
/** Get shutdown status. */
int GetShutdown();
+
/** Returns IPPROTO_TCP or IPPROTO_SCTP */
virtual int Protocol() = 0;
+
protected:
StreamSocket(const StreamSocket& ) {} // copy constructor
+
private:
StreamSocket& operator=(const StreamSocket& ) { return *this; } // assignment operator
+
bool m_bConnecting; ///< Flag indicating connection in progress
int m_connect_timeout; ///< Connection timeout (seconds)
bool m_flush_before_close; ///< Send all data before closing (default true)
@@ -88,9 +117,12 @@ private:
int m_shutdown; ///< Shutdown status
};
+
#ifdef SOCKETS_NAMESPACE
} // namespace SOCKETS_NAMESPACE {
#endif
+
#endif // _StreamSocket_H
+