NBS.UDP_Receive (FB)

This function block of the CAA_NetBaseServices.library serves to receive data from the connection given in hPeer. As long as xEnable is TRUE the handle of the peer is valid. The pointer pData specifies the memory area to write the read data to. szSize defines the max number of bytes to read. When data was read successfully, xReady is set to TRUE and szCount indicates the actually read number of bytes. ipFrom and uiPortFrom indicate the IP and port the data was received from.

Input:

xEnable

BOOL

see: “CAA 指南”

hPeer

CAA.HANDLE

Handle of Peer

szSize

CAA.SIZE

Maximum number of bytes to be read; can be retrieved via operator SIZEOF

pData

CAA.PVOID

Target address for the first byte to be read; can be retrieved via operator ADR

Output:

xDone

BOOL

see: “CAA 指南”

xBusy

BOOL

see: “CAA 指南”

xError

BOOL

see: “CAA 指南”

eError

NBS.ERROR

Error id

xReady

BOOL

TRUE: Data received

FALSE: No data received

ipFrom

NBS.IP_ADDR

The ip address the data was received from

uiPortFrom

UINT

The port the data was received from

szCount

CAA.SIZE

Size of the received data