ADTF  3.18.2
datagramsocket.h
Go to the documentation of this file.
1 
7 #ifndef _DATAGRAM_SOCKET_CLASS_HEADER_
8 #define _DATAGRAM_SOCKET_CLASS_HEADER_
9 
10 namespace A_UTILS_NS
11 {
12 
28 class DOEXPORT cDatagramSocket : public cSocket
29 {
31 
32  protected:
34  typedef struct
35  {
36  tVoid* pData;
37  tInt nDataLength;
38  } tIOVector;
40 
41  public:
46 
50  virtual ~cDatagramSocket();
51 
61 #ifdef WIN32
85 #else // WIN32
101 #endif // WIN32
108  tResult Open(tInt nPort = 0, tUInt32 dwMode = cSocket::OM_Block, tUInt32 ui32InterfaceAddress = 0);
109 
122 #ifdef WIN32
163 #else // WIN32
189 #endif // WIN32
194  tResult Write(const cString& strDest, tInt nPort, const tVoid* pData, tInt nDataLength, tInt* pnBytesWritten=nullptr);
195 
208 #ifdef WIN32
248 #else // WIN32
273 #endif // WIN32
278  tResult Write(tUInt32 dwDest, tInt nPort, const tVoid* pData, tInt nDataLength, tInt* pnBytesWritten=nullptr);
279 
291 #ifdef WIN32
322 #else // WIN32
341 #endif // WIN32
346  tResult Read(tVoid* pBuffer, tInt nBufferSize, tInt* pnBytesRead=nullptr, tUInt32* pSenderAddr=nullptr, tUInt16* pSenderPort = nullptr);
347 
355 #ifdef WIN32
375 #else // WIN32
386 #endif // WIN32
387  /*
388  * @fn tResult EnableBroadcasts(tBool bEnable)
389  * @retval ERR_UNEXPECTED Other error detected
390  */
392 
406 #ifdef WIN32
426 #else // WIN32
437 #endif // WIN32
438  /*
439  * @fn tResult JoinMulticastGroup(tUInt32 nGroupAddr)
440  * @retval ERR_UNEXPECTED Other error detected
441  */
443 
449 #ifdef WIN32
469 #else // WIN32
480 #endif // WIN32
481  /*
482  * @fn tResult LeaveMulticastGroup(tUInt32 nGroupAddr)
483  * @retval ERR_UNEXPECTED Other error detected
484  */
486 
487  protected:
488 };
489 
490 } // namespace A_UTILS_NS
491 
492 #endif // _DATAGRAM_SOCKET_CLASS_HEADER_
void tVoid
The tVoid is always the definition for the void (non-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).
uint32_t tUInt32
type definition for unsigned integer values (32bit) (platform and compiler independent type).
Datagram socket class.
tResult JoinMulticastGroup(tUInt32 nGroupAddr)
Joins a specified multicast group.
tResult LeaveMulticastGroup(tUInt32 nGroupAddr)
Leaves a specified multicast group.
tResult EnableBroadcasts(tBool bEnable=tTrue)
If enabled, the socket will receive packets sent to a broadcast address and will be able to send pack...
virtual ~cDatagramSocket()
Destructor.
Socket class.
Definition: socket.h:24
#define tTrue
Value for tBool.
Definition: constants.h:62
#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