Skip to main content
Open topic with navigation CAPL Functions » TCP/IP API » UdpReceiveFrom

UdpReceiveFrom

Valid for: CANoe DE • CANoe4SW DE

Function Syntax

long UdpReceiveFrom( dword socket, char buffer[], dword size);

Method Syntax

Method Syntax
socket.ReceiveFrom( char buffer[], dword size);

Description

The function receives data into the specified buffer. If the receive operation does not complete immediately the operation is performed asynchronously and the function will return SOCKET_ERROR (-1). Use IpGetLastSocketError to get a more specific error code. If the specific error code is WSA_IO_PENDING (997) the CAPL callback OnUdpReceiveFrom will be called on completion (successful or not), provided it is implemented in the same CAPL program.

Parameters

  • socket: The socket handle.
  • buffer: The buffer used to store the incoming data.
  • size: The size of the data buffer.

Return Values

  • 0: The function completed successfully.
  • WSA_INVALID_PARAMETER (87): The specified socket was invalid.
  • SOCKET_ERROR (-1): The function failed. Call IpGetLastSocketError to get a more specific error code.

Example

See example Create UDP Server Sockets. UdpOpenUdpCloseUdpSendToOnUdpReceiveFrom