ADTF  3.18.2
streamsocket.h
Go to the documentation of this file.
1 
7 #ifndef _STREAM_SOCKET_CLASS_HEADER_
8 #define _STREAM_SOCKET_CLASS_HEADER_
9 
10 namespace A_UTILS_NS
11 {
12 
13 class cServerSocket;
14 
21 class DOEXPORT cStreamSocket : public cSocket
22 {
24 
25  public:
30 
34  virtual ~cStreamSocket();
35 
44 #ifdef WIN32
68 #else // WIN32
84 #endif // WIN32
92  tResult Connect(const cString& strDest, tInt nPort, tUInt32 dwMode = OM_Block);
93 
102 #ifdef WIN32
126 #else // WIN32
142 #endif // WIN32
150  tResult Connect(tUInt32 dwDest, tInt nPort, tUInt32 dwMode=OM_Block);
151 
165  tBool IsConnected(tTimeStamp nTimeout = 0);
166 
177 #ifdef WIN32
215 #else // WIN32
239 #endif // WIN32
244  tResult Write(const void* pData, tInt nDataLength, tInt* pnBytesWritten=nullptr);
245 
256 #ifdef WIN32
290 #else // WIN32
308 #endif // WIN32
313  tResult Read(void* pBuffer, tInt nBufferSize, tInt* pnBytesRead=nullptr);
314 
315  friend class cServerSocket;
316 };
317 
324 class DOEXPORT cServerSocket : public cSocket
325 {
327 
328  public:
333  {
336  SS_Exclusive = 1
337  };
338 
339  public:
344 
348  virtual ~cServerSocket();
349 
357 #ifdef WIN32
381 #else // WIN32
397 #endif // WIN32
407  tResult Open(tInt nPort, tUInt32 dwMode = 0, tUInt32 ui32InterfaceAddress = 0);
408 
414 #ifdef WIN32
433 #else // WIN32
445 #endif // WIN32
450  tResult Listen(tInt nMaxRequests=0);
451 
457 #ifdef WIN32
482 #else // WIN32
502 #endif // WIN32
507  tResult Accept(cStreamSocket& oStreamSocket);
508 
514 #ifdef WIN32
539 #else // WIN32
559 #endif // WIN32
564  tResult Accept(tSocketHandle& hClientSocket);
565 
579  tBool IsConnected(tTimeStamp nTimeout = 0);
580 };
581 
582 } // namespace A_UTILS_NS
583 
584 #endif // _STREAM_SOCKET_CLASS_HEADER_
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
TCP Server socket class.
Definition: streamsocket.h:325
tBool IsConnected(tTimeStamp nTimeout=0)
Polls the socket for its connection state.
virtual ~cServerSocket()
Destructor.
cServerSocket()
Default constructor.
Socket class.
Definition: socket.h:24
tOpenMode
The mode in which to run the sockets during and after a connection.
Definition: socket.h:70
TCP Client socket class.
Definition: streamsocket.h:22
cStreamSocket()
Default constructor.
virtual ~cStreamSocket()
Destructor.
tBool IsConnected(tTimeStamp nTimeout=0)
Polls the socket for its connection state.
#define A_UTILS_D(__pclassname_)
Helper macro for d-pattern definitions.
Definition: d_ptr.h:270
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11