Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libMiMic by
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_port port number. i_nobuffer false(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_addr must 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.
Generated on Tue Jul 12 2022 16:23:00 by
