simple-socket library 1.2.0
UDPSocket.h
Go to the documentation of this file.
1#ifndef NET_UDPSocket_h__
2#define NET_UDPSocket_h__
3
4#include "InternetSocket.h"
5
6namespace NET
7{
9 class UDPSocket : public InternetSocket
10 {
11 public:
16 UDPSocket();
17
37 void sendTo( const void* buffer, size_t len, std::string_view foreignAddress, unsigned short foreignPort);
38
53 int receiveFrom( void* buffer, size_t len, std::string& sourceAddress, unsigned short& sourcePort);
54
72 int timedReceiveFrom( void* buffer, size_t len, std::string& sourceAddress, unsigned short& sourcePort, int timeout);
73
79 void setMulticastTTL( unsigned char multicastTTL);
80
86 void setMulticastInterfaceAddr( const std::string& address);
87
96 void joinGroup( const std::string& multicastGroup);
97
106 void leaveGroup( const std::string& multicastGroup);
107 };
108
109} // namespace NET
110
111#endif // NET_UDPSocket_h__
static const int len
Definition CANFrame.h:7
InternetSocket(int sockfd)
create socket from a SocketHandle returned by an accept() call
int timedReceiveFrom(void *buffer, size_t len, std::string &sourceAddress, unsigned short &sourcePort, int timeout)
Definition UDPSocket.cpp:72
int receiveFrom(void *buffer, size_t len, std::string &sourceAddress, unsigned short &sourcePort)
Definition UDPSocket.cpp:57
void setMulticastTTL(unsigned char multicastTTL)
Definition UDPSocket.cpp:92
void setMulticastInterfaceAddr(const std::string &address)
void joinGroup(const std::string &multicastGroup)
void sendTo(const void *buffer, size_t len, std::string_view foreignAddress, unsigned short foreignPort)
Definition UDPSocket.cpp:45
void leaveGroup(const std::string &multicastGroup)