FB_UDPPeer - Method ReceiveFrom
Read data stored in the receive buffer.
Reads data stored in the receive buffer and removes it from the buffer if it has been read without detecting an error. At most one message is read no matter how much data is available to be read and how large is the application-provided buffer.
The UDINT return value indicates the number of bytes written to the application-provided buffer.
Input |
Data type |
Valid range |
Description |
---|---|---|---|
i_pbyReceiveBuffer |
POINTER TO BYTE |
- |
Start address of the buffer to write the received data to. |
i_udiReceiveBufferSize |
UDINT |
1 ... 2147483647 |
Number of bytes to be read. NOTE: The value must not be greater than the size of the buffer. |
Output |
Data type |
Valid range |
Description |
---|---|---|---|
q_xDataReceived |
BOOL |
- |
Indicates whether a message was received. |
q_sPeerIP |
STRING(15) |
- |
Source IP of the peer from whom the message was received in STRING representation. |
q_dwPeerIP |
DWORD |
- |
IP address of the peer (sender) as DWORD; each byte represents one digit of the IPv4 address. |
q_uiPeerPort |
UINT |
- |
Source port the message was received from. |