Radius
Public Member Functions | List of all members
UDPSocket Class Reference

Class to encapsulate a UDP socket. More...

#include <UDPSocket.h>

Public Member Functions

 UDPSocket ()
 Constructor.
 
void begin ()
 Initialise the socket.
 
uint16_t sendto (const uint8_t *data, uint16_t length, IP4Address address, uint16_t port)
 
uint16_t available ()
 
uint16_t recvfrom (uint8_t *data, uint16_t maxLength, IP4Address address, uint16_t *port)
 

Detailed Description

Class to encapsulate a UDP socket.

This class is used by RadiusMsg to send and receive UDP requests on a LAN through the Arduino Ethernet shield. This is needed because the revfrom function in utilitysocket.c in the Ethernet library does not work properly

Member Function Documentation

uint16_t UDPSocket::available ( )

Checks whether a UDP packet is available.

Returns
Returns the number of octets in the next available packet, else 0

Referenced by recvfrom(), and RadiusMsg::sendWaitReply().

uint16_t UDPSocket::recvfrom ( uint8_t *  data,
uint16_t  maxLength,
IP4Address  address,
uint16_t *  port 
)
Parameters
[in]data
[in]maxLength
[in]addressPointer to an IP4Address which wil be filled in with the senders IP address
[in]portPointer to a port number which will be filled in with the senders port number

References available().

Referenced by RadiusMsg::recv().

uint16_t UDPSocket::sendto ( const uint8_t *  data,
uint16_t  length,
IP4Address  address,
uint16_t  port 
)

Send octets to the given address

Parameters
[in]dataData octets to send in a UDP packet
[in]lengthNumber of octets of data
[in]addressIP4Address of teh destination host
[in]portPort number of the destination pport

Referenced by RadiusMsg::sendto().


The documentation for this class was generated from the following files: