Socket structure sending UDP messages. More...
#include <udpclient.h>
Public Member Functions | |
UdpClient () | |
Default constructor. | |
virtual | ~UdpClient () |
Default constructor. | |
int | InitializeSocket (const IP4Address &ipAddress, const unsigned short destinationPort, const unsigned short sourcePort=0) |
Initializes as a socket for connecting to a UDP server. | |
int | InitializeMulticastSocket (const IP4Address &multicastGroup, const unsigned short destinationPort, const unsigned char ttl=16, const bool broadcastFlag=false, const unsigned short sourcePort=0, const bool allowReuse=true) |
Initializes as a socket for sending to a multicast address. | |
virtual void | Shutdown () |
Closes the socket. | |
IP4Address | GetConnectionAddress () const |
unsigned short | GetDestinationPort () const |
unsigned short | GetSourcePort () const |
UdpClient * | CreateNewDestination (const IP4Address &ipAddress, const unsigned short destinationPort=0) const |
Friends | |
class | UdpServer |
Socket structure sending UDP messages.
UdpClient is a one way socket which can only be used for transmision of packet data over UDP/IP. It does not bind to the socket, therefore it cannot receive any data. To receive UDP data, use the UdpServer class.
Definition at line 59 of file udpclient.h.
UdpClient::UdpClient | ( | ) |
Default constructor.
Definition at line 52 of file udpclient.cpp.
UdpClient::~UdpClient | ( | ) | [virtual] |
Default constructor.
Definition at line 70 of file udpclient.cpp.
UdpClient * UdpClient::CreateNewDestination | ( | const IP4Address & | ipAddress, |
const unsigned short | destinationPort = 0 |
||
) | const |
Definition at line 492 of file udpclient.cpp.
IP4Address CxUtils::UdpClient::GetConnectionAddress | ( | ) | const [inline] |
Definition at line 75 of file udpclient.h.
unsigned short CxUtils::UdpClient::GetDestinationPort | ( | ) | const [inline] |
Definition at line 76 of file udpclient.h.
unsigned short CxUtils::UdpClient::GetSourcePort | ( | ) | const [inline] |
Definition at line 77 of file udpclient.h.
int UdpClient::InitializeMulticastSocket | ( | const IP4Address & | multicastGroup, |
const unsigned short | destinationPort, | ||
const unsigned char | ttl = 16 , |
||
const bool | broadcastFlag = false , |
||
const unsigned short | sourcePort = 0 , |
||
const bool | allowReuse = true |
||
) |
Initializes as a socket for sending to a multicast address.
[in] | multicastGroup | The multicast group to connect to. This is an IP address in the range of "224.0.0.0-239.255.255.255" |
[in] | destinationPort | The port to send to. |
[in] | ttl | Time To Live (TTL). Default value is 1, meaning the data only goes as far as the local network, increase to go further out. |
[in] | broadcastFlag | If true, create a Broadcast Socket which is global. |
[in] | sourcePort | The port origin port the data will be sent from. If the value is 0, then any available port is chosen. This is also the port that the Rev methods will listen on. |
[in] | allowReuse | If true, then multiple udp server sockets can run on single host. If you need multiple sockets with the same port, you should use the UdpSharedServer instead. However, if you are only using multicast, then this is OK to be true. |
Definition at line 307 of file udpclient.cpp.
int UdpClient::InitializeSocket | ( | const IP4Address & | ipAddress, |
const unsigned short | destinationPort, | ||
const unsigned short | sourcePort = 0 |
||
) |
Initializes as a socket for connecting to a UDP server.
[in] | ipAddress | The IP Address information of the destination host you want to send data to. |
[in] | destinationPort | The port to send to. |
[in] | sourcePort | The port origin port the data will be sent from. If the value is 0, then any available port is chosen. This is also the port that the Rev methods will listen on. |
Definition at line 128 of file udpclient.cpp.
void UdpClient::Shutdown | ( | ) | [virtual] |
friend class UdpServer [friend] |
Definition at line 61 of file udpclient.h.