Public Member Functions | Friends

CxUtils::UdpClient Class Reference

Socket structure sending UDP messages. More...

#include <udpclient.h>

Inheritance diagram for CxUtils::UdpClient:
Inheritance graph
[legend]

List of all members.

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
UdpClientCreateNewDestination (const IP4Address &ipAddress, const unsigned short destinationPort=0) const

Friends

class UdpServer

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Parameters:
[in]multicastGroupThe multicast group to connect to. This is an IP address in the range of "224.0.0.0-239.255.255.255"
[in]destinationPortThe port to send to.
[in]ttlTime To Live (TTL). Default value is 1, meaning the data only goes as far as the local network, increase to go further out.
[in]broadcastFlagIf true, create a Broadcast Socket which is global.
[in]sourcePortThe 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]allowReuseIf 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.
Returns:
1 if socket created, otherwise 0.

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.

Parameters:
[in]ipAddressThe IP Address information of the destination host you want to send data to.
[in]destinationPortThe port to send to.
[in]sourcePortThe 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.
Returns:
1 if socket created, otherwise 0.

Definition at line 128 of file udpclient.cpp.

void UdpClient::Shutdown (  ) [virtual]

Closes the socket.

Reimplemented from CxUtils::Socket.

Definition at line 80 of file udpclient.cpp.


Friends And Related Function Documentation

friend class UdpServer [friend]

Definition at line 61 of file udpclient.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines