3 #include "StreamSocket.h"
4 #include "ISocketHandler.h"
7 #ifdef SOCKETS_NAMESPACE
8 namespace SOCKETS_NAMESPACE
{
12 StreamSocket::StreamSocket(ISocketHandler
& h
) : Socket(h
)
15 ,m_flush_before_close(true)
16 ,m_connection_retry(0)
18 ,m_call_on_connect(false)
19 ,m_b_retry_connect(false)
20 ,m_line_protocol(false)
26 StreamSocket::~StreamSocket()
31 void StreamSocket::SetConnecting(bool x
)
33 if (x
!= m_bConnecting
)
38 SetTimeout( GetConnectTimeout() );
48 bool StreamSocket::Connecting()
54 bool StreamSocket::Ready()
56 if (GetSocket() != INVALID_SOCKET
&& !Connecting() && !CloseAndDelete())
62 void StreamSocket::SetConnectTimeout(int x
)
64 m_connect_timeout
= x
;
68 int StreamSocket::GetConnectTimeout()
70 return m_connect_timeout
;
74 void StreamSocket::SetFlushBeforeClose(bool x
)
76 m_flush_before_close
= x
;
80 bool StreamSocket::GetFlushBeforeClose()
82 return m_flush_before_close
;
86 int StreamSocket::GetConnectionRetry()
88 return m_connection_retry
;
92 void StreamSocket::SetConnectionRetry(int x
)
94 m_connection_retry
= x
;
98 int StreamSocket::GetConnectionRetries()
104 void StreamSocket::IncreaseConnectionRetries()
110 void StreamSocket::ResetConnectionRetries()
116 void StreamSocket::SetCallOnConnect(bool x
)
118 Handler().AddList(GetSocket(), LIST_CALLONCONNECT
, x
);
119 m_call_on_connect
= x
;
123 bool StreamSocket::CallOnConnect()
125 return m_call_on_connect
;
129 void StreamSocket::SetRetryClientConnect(bool x
)
131 Handler().AddList(GetSocket(), LIST_RETRY
, x
);
132 m_b_retry_connect
= x
;
136 bool StreamSocket::RetryClientConnect()
138 return m_b_retry_connect
;
142 void StreamSocket::SetLineProtocol(bool x
)
148 bool StreamSocket::LineProtocol()
150 return m_line_protocol
;
154 void StreamSocket::SetShutdown(int x
)
160 int StreamSocket::GetShutdown()
168 #ifdef SOCKETS_NAMESPACE
169 } // namespace SOCKETS_NAMESPACE {