00001 #ifndef _StreamSocket_H
00002 #define _StreamSocket_H
00003
00004 #include "Socket.h"
00005
00006
00007 #ifdef SOCKETS_NAMESPACE
00008 namespace SOCKETS_NAMESPACE {
00009 #endif
00010
00011
00014 class StreamSocket : public Socket
00015 {
00016 public:
00017 StreamSocket(ISocketHandler& );
00018 ~StreamSocket();
00019
00021 void SetConnecting(bool = true);
00022
00025 bool Connecting();
00026
00030 bool Ready();
00031
00034 void SetConnectTimeout(int x);
00035
00038 int GetConnectTimeout();
00039
00042 void SetFlushBeforeClose(bool = true);
00043
00046 bool GetFlushBeforeClose();
00047
00052 void SetConnectionRetry(int n);
00053
00055 int GetConnectionRetry();
00056
00058 void IncreaseConnectionRetries();
00059
00061 int GetConnectionRetries();
00062
00064 void ResetConnectionRetries();
00065
00066
00067
00069 void SetCallOnConnect(bool x = true);
00070
00073 bool CallOnConnect();
00074
00075
00076
00078 void SetRetryClientConnect(bool x = true);
00079
00082 bool RetryClientConnect();
00083
00088 virtual void SetLineProtocol(bool = true);
00089
00092 bool LineProtocol();
00093
00095 void SetShutdown(int);
00096
00098 int GetShutdown();
00099
00101 virtual int Protocol() = 0;
00102
00103 protected:
00104 StreamSocket(const StreamSocket& ) {}
00105
00106 private:
00107 StreamSocket& operator=(const StreamSocket& ) { return *this; }
00108
00109 bool m_bConnecting;
00110 int m_connect_timeout;
00111 bool m_flush_before_close;
00112 int m_connection_retry;
00113 int m_retries;
00114 bool m_call_on_connect;
00115 bool m_b_retry_connect;
00116 bool m_line_protocol;
00117 int m_shutdown;
00118 };
00119
00120
00121 #ifdef SOCKETS_NAMESPACE
00122 }
00123 #endif
00124
00125
00126 #endif // _StreamSocket_H