38#include "blocxx/BLOCXX_config.h"
40#if !defined(BLOCXX_WIN32)
64#include <sys/socket.h>
70#include <netinet/in.h>
100 , m_isConnected(
false)
104 , m_recvTimeoutExprd(
false)
107 , m_out(&m_streamBuf)
108 , m_inout(&m_streamBuf)
109 , m_recvTimeout(
Timeout::infinite)
110 , m_sendTimeout(
Timeout::infinite)
111 , m_connectTimeout(
Timeout::infinite)
113 m_out.exceptions(std::ios::badbit);
114 m_inout.exceptions(std::ios::badbit);
121 , m_isConnected(
true)
125 , m_recvTimeoutExprd(
false)
128 , m_out(&m_streamBuf)
129 , m_inout(&m_streamBuf)
130 , m_recvTimeout(
Timeout::infinite)
131 , m_sendTimeout(
Timeout::infinite)
132 , m_connectTimeout(
Timeout::infinite)
134 m_out.exceptions(std::ios::badbit);
135 m_inout.exceptions(std::ios::badbit);
153 , m_isConnected(
false)
156 , m_peerAddress(
addr)
157 , m_recvTimeoutExprd(
false)
160 , m_out(&m_streamBuf)
161 , m_inout(&m_streamBuf)
162 , m_recvTimeout(
Timeout::infinite)
163 , m_sendTimeout(
Timeout::infinite)
164 , m_connectTimeout(
Timeout::infinite)
166 m_out.exceptions(std::ios::badbit);
167 m_inout.exceptions(std::ios::badbit);
207#ifdef BLOCXX_HAVE_IPV6
220 "Failed to create a socket");
231#if defined(BLOCXX_NCR)
258 sockSo.waitForRead =
true;
259 sockSo.waitForWrite =
true;
264 pipeSo.waitForRead =
true;
290 if (
selra.size() == 2 &&
selra[1].readAvailable)
294 else if (
selra[0].readAvailable ||
selra[0].writeAvailable)
298#if defined(BLOCXX_NCR)
305 "SocketBaseImpl::connect() getsockopt() failed");
311 "SocketBaseImpl::connect() failed");
359 m_in.clear(ios::eofbit);
363 m_out.clear(ios::eofbit);
#define BLOCXX_ASSERT(CON)
BLOCXX_ASSERT works similar to the assert() macro, but instead of calling abort(),...
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
#define BLOCXX_THROW_ERRNO_MSG(exType, msg)
Throw an exception using FILE, LINE, errno and strerror(errno)
#define BLOCXX_GLOBAL_MUTEX_INIT()
#define BLOCXX_LOG_ERROR(logger, message)
Log message to logger with the Error level.
Array<> wraps std::vector<> in COWReference<> adding ref counting and copy on write capability.
PURPOSE: The AutoResource class template is an analog of std::auto_ptr for managing arbitrary resourc...
The DateTime class is an abstraction for date time data.
void setToCurrent()
Set this DateTime to the current system time.
void assignFromNativeForm(const UnixSocketAddress_t *address, size_t len)
std::istream & getInputStream()
virtual void disconnect()
virtual void connect(const SocketAddress &addr)
SocketStreamBuffer m_streamBuf
std::ostream & getOutputStream()
virtual ~SocketBaseImpl()
SocketAddress m_peerAddress
static String m_traceFileOut
virtual int readAux(void *dataIn, int dataInLen)=0
Select_t getSelectObj() const
virtual bool waitForInput(const Timeout &timeout)
SocketAddress m_localAddress
static String m_traceFileIn
virtual int writeAux(const void *dataOut, int dataOutLen)=0
bool waitForOutput(const Timeout &timeout)
int write(const void *dataOut, int dataOutLen, ErrorAction errorAsException=E_RETURN_ON_ERROR)
Write a specified number of bytes to the device that is exposing the IOIFC interface.
std::iostream & getIOStream()
static void setDumpFiles(const String &in, const String &out)
int read(void *dataIn, int dataInLen, ErrorAction errorAsException=E_RETURN_ON_ERROR)
Read a specified number of bytes from the device that is exposing the IOIFC interface.
SocketHandle_t getfd() const
static ShutDownMechanism_t getShutDownMechanism()
This String class is an abstract data type that represents as NULL terminated string of characters.
const char * c_str() const
static void testCancel()
Test if this thread has been cancelled.
A timeout can be absolute, which means that it will happen at the specified DateTime.
A TimeoutTimer is used by an algorithm to determine when a timeout has expired.
const int SELECT_TIMEOUT
The value returned from select when the timeout value has expired.
int selectRW(SelectObjectArray &selarray, UInt32 ms)
const int SELECT_ERROR
The value returned from select when any error occurs other than timeout.
int waitForIO(SocketHandle_t fd, int timeOutSecs, SocketFlags::EWaitDirectionFlag waitFlag)
Wait for input or output on a socket.
sockaddr_in InetSocketAddress_t
bool operator==(const Array< T > &x, const Array< T > &y)
sockaddr_un UnixSocketAddress_t
LazyGlobal< Mutex, int, GlobalMutexFactory > GlobalMutex