1 #include "StreamSocket.h"
2 #include "ISocketHandler.h"
5 #ifdef SOCKETS_NAMESPACE
6 namespace SOCKETS_NAMESPACE
{
10 StreamSocket::StreamSocket(ISocketHandler
& h
) : Socket(h
)
13 ,m_flush_before_close(true)
14 ,m_connection_retry(0)
16 ,m_call_on_connect(false)
17 ,m_b_retry_connect(false)
18 ,m_line_protocol(false)
24 StreamSocket::~StreamSocket()
29 void StreamSocket::SetConnecting(bool x
)
31 if (x
!= m_bConnecting
)
36 SetTimeout( GetConnectTimeout() );
46 bool StreamSocket::Connecting()
52 bool StreamSocket::Ready()
54 if (GetSocket() != INVALID_SOCKET
&& !Connecting() && !CloseAndDelete())
60 void StreamSocket::SetConnectTimeout(int x
)
62 m_connect_timeout
= x
;
66 int StreamSocket::GetConnectTimeout()
68 return m_connect_timeout
;
72 void StreamSocket::SetFlushBeforeClose(bool x
)
74 m_flush_before_close
= x
;
78 bool StreamSocket::GetFlushBeforeClose()
80 return m_flush_before_close
;
84 int StreamSocket::GetConnectionRetry()
86 return m_connection_retry
;
90 void StreamSocket::SetConnectionRetry(int x
)
92 m_connection_retry
= x
;
96 int StreamSocket::GetConnectionRetries()
102 void StreamSocket::IncreaseConnectionRetries()
108 void StreamSocket::ResetConnectionRetries()
114 void StreamSocket::SetCallOnConnect(bool x
)
116 Handler().AddList(GetSocket(), LIST_CALLONCONNECT
, x
);
117 m_call_on_connect
= x
;
121 bool StreamSocket::CallOnConnect()
123 return m_call_on_connect
;
127 void StreamSocket::SetRetryClientConnect(bool x
)
129 Handler().AddList(GetSocket(), LIST_RETRY
, x
);
130 m_b_retry_connect
= x
;
134 bool StreamSocket::RetryClientConnect()
136 return m_b_retry_connect
;
140 void StreamSocket::SetLineProtocol(bool x
)
146 bool StreamSocket::LineProtocol()
148 return m_line_protocol
;
152 void StreamSocket::SetShutdown(int x
)
158 int StreamSocket::GetShutdown()
166 #ifdef SOCKETS_NAMESPACE
167 } // namespace SOCKETS_NAMESPACE {