ADTF
Loading...
Searching...
No Matches
streamsocket.h
Go to the documentation of this file.
1
7#pragma once
8
9namespace A_UTILS_NS
10{
11
12class cServerSocket;
13
20class cStreamSocket : public cSocket
21{
23
24 public:
29
33 virtual ~cStreamSocket();
34
43#ifdef WIN32
67#else // WIN32
83#endif // WIN32
91 tResult Connect(const cString& strDest, tInt nPort, tUInt32 dwMode = OM_Block);
92
101#ifdef WIN32
125#else // WIN32
141#endif // WIN32
149 tResult Connect(tUInt32 dwDest, tInt nPort, tUInt32 dwMode=OM_Block);
150
165
176#ifdef WIN32
214#else // WIN32
238#endif // WIN32
243 tResult Write(const void* pData, tInt nDataLength, tInt* pnBytesWritten=nullptr);
244
255#ifdef WIN32
289#else // WIN32
307#endif // WIN32
312 tResult Read(void* pBuffer, tInt nBufferSize, tInt* pnBytesRead=nullptr);
313
314 friend class cServerSocket;
315};
316
323class cServerSocket : public cSocket
324{
326
327 public:
332 {
336 };
337
338 public:
343
347 virtual ~cServerSocket();
348
356#ifdef WIN32
380#else // WIN32
396#endif // WIN32
406 tResult Open(tInt nPort, tUInt32 dwMode = 0, tUInt32 ui32InterfaceAddress = 0);
407
413#ifdef WIN32
432#else // WIN32
444#endif // WIN32
449 tResult Listen(tInt nMaxRequests=0);
450
456#ifdef WIN32
481#else // WIN32
501#endif // WIN32
506 tResult Accept(cStreamSocket& oStreamSocket);
507
513#ifdef WIN32
538#else // WIN32
558#endif // WIN32
563 tResult Accept(tSocketHandle& hClientSocket);
564
579};
580
581} // namespace A_UTILS_NS
unsigned long tUInt32
type definition for unsigned integer values (32bit) (platform and compiler independent type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
TCP Server socket class.
tResult Open(tInt nPort, tUInt32 dwMode=0, tUInt32 ui32InterfaceAddress=0)
Opens the socket.
tResult Accept(cStreamSocket &oStreamSocket)
Accepts an incoming connection.
tResult Accept(tSocketHandle &hClientSocket)
Accepts an incoming connection.
tResult Listen(tInt nMaxRequests=0)
Puts the socket in listen mode.
tBool IsConnected(tTimeStamp nTimeout=0)
Polls the socket for its connection state.
virtual ~cServerSocket()
Destructor.
@ SS_Exclusive
The default SO_REUSEADDR�option is not set when this is specified.
cServerSocket()
Default constructor.
cSocket()
Default constructor.
TCP Client socket class.
cStreamSocket()
Default constructor.
virtual ~cStreamSocket()
Destructor.
tResult Write(const void *pData, tInt nDataLength, tInt *pnBytesWritten=nullptr)
Sends a data over the socket.
tResult Connect(tUInt32 dwDest, tInt nPort, tUInt32 dwMode=OM_Block)
Connects the socket with a remote listening socket.
tResult Read(void *pBuffer, tInt nBufferSize, tInt *pnBytesRead=nullptr)
Read incoming data.
tBool IsConnected(tTimeStamp nTimeout=0)
Polls the socket for its connection state.
tResult Connect(const cString &strDest, tInt nPort, tUInt32 dwMode=OM_Block)
Connects the socket with a remote listening socket.
#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 util or adtf_util.
Definition d_ptr.h:11
int tSocketHandle
work with platform undependend typedefinitions for socket handlers
Definition sockettypes.h:15
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition string.h:2785