This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Embed: (wiki syntax)

« Back to documentation index

UdpSocket Class Reference

Udp Socket Class. More...

#include <UdpSocket.h>

Public Member Functions

NyLPC_TiUdpSocket_t * refBaseInstance ()
 wrapped base LPC class.
 UdpSocket (unsigned short i_port, bool i_nobuffer=false)
 Create standard UDP socket.
int precvFrom (const void *&i_rx, IpAddr *i_peer_host=NULL, unsigned short *i_port=NULL)
 This function return recieved data and size.
void precvNext (void)
 This function moves rx buffer to next packet.
bool canRecv ()
 true if precv has data.

Protected Member Functions

virtual void onRxHandler (const void *i_buf, const struct NyLPC_TIPv4RxInfo *i_info)
 callback function.

Detailed Description

Udp Socket Class.

The class is used by Net constructor.

Definition at line 16 of file UdpSocket.h.


Constructor & Destructor Documentation

UdpSocket ( unsigned short  i_port,
bool  i_nobuffer = false 
)

Create standard UDP socket.

Parameters:
i_portport number.
i_nobufferfalse(default) - UDP packets will be receive to internal buffer. It can be access by precvFrom/precvNext function. It is accepts only "Short" packet. MUST BE SET NyLPC_cMiMicIpNetIf_config_UDPSOCKET_MAX 1 or more when MiMicIPNetInterface using. true - UDP packets will be handled to onRxHandler function. It is accepts "Full size" packet. MUST BE SET NyLPC_cMiMicIpNetIf_config_UDPSOCKET_NB_MAX 1 or more when MiMicIPNetInterface using.

Definition at line 20 of file UdpSocket.cpp.


Member Function Documentation

bool canRecv (  )

true if precv has data.

This can avoid the block of precv.

Definition at line 35 of file UdpSocket.cpp.

virtual void onRxHandler ( const void *  i_buf,
const struct NyLPC_TIPv4RxInfo i_info 
) [protected, virtual]

callback function.

MUST be override when used callback constructor.

Definition at line 68 of file UdpSocket.h.

int precvFrom ( const void *&  i_rx,
IpAddr i_peer_host = NULL,
unsigned short *  i_port = NULL 
)

This function return recieved data and size.

The function sets the head of the oldest readable buffer. A position is not changed until precvnext was called.

Parameters:
i_host_addrmust be IPv4 address format.

Definition at line 42 of file UdpSocket.cpp.

void precvNext ( void   )

This function moves rx buffer to next packet.

Definition at line 71 of file UdpSocket.cpp.

NyLPC_TiUdpSocket_t* refBaseInstance (  )

wrapped base LPC class.

Definition at line 22 of file UdpSocket.h.