UdpSendTo
Valid for: CANoe DE • CANoe4SW DEFunction Syntax
long UdpSendTo( dword socket, dword address, dword port, char buffer[], dword size); // form 1long UdpSendTo( dword socket, byte ipv6Address[], dword port, char buffer[], dword size); // form 2long UdpSendTo( dword socket, dword address, dword port, struct data[], dword size); // form 3long UdpSendTo( dword socket, dword address, dword port, byte buffer[], dword size); // form 4long UdpSendTo( dword socket, byte ipv6Address[], dword port, struct data[], dword size); // form 5long UdpSendTo( dword socket, byte ipv6Address[], dword port, byte buffer[], dword size); // form 6long UdpSendTo( dword socket, IP_Endpoint remoteEndpoint, char buffer[], dword size); // form 7long UdpSendTo( dword socket, IP_Endpoint remoteEndpoint, byte buffer[], dword size); // form 8long UdpSendTo( dword socket, IP_Endpoint remoteEndpoint, struct data[], dword size); // form 9
Method Syntax
socket.SendTo( dword address, dword port, char buffer[], dword size); // form 1socket.SendTo( byte ipv6Address[], dword port, char buffer[], dword size); // form 2socket.SendTo( dword address, dword port, struct data[], dword size); // form 3socket.SendTo( dword address, dword port, byte buffer[], dword size); // form 4socket.SendTo( byte ipv6Address[], dword port, struct data[], dword size); // form 5socket.SendTo( byte ipv6Address[], dword port, byte buffer[], dword size); // form 6socket.SendTo( IP_Endpoint remoteEndpoint, char buffer[], dword size); // form 7socket.SendTo( IP_Endpoint remoteEndpoint, byte buffer[], dword size); // form 8socket.SendTo( IP_Endpoint remoteEndpoint, struct data[], dword size); // form 9
Description
The function sends data to the specified location. If the send operation does not complete immediately, the operation is performed asynchronously and the function will returnSOCKET_ERROR (-1). Use IpGetLastSocketError to get a more specific error code. If the specific error code is WSA_IO_PENDING (997), the CAPL callback OnUdpSendTo will be called on completion (successful or not), providing that it is implemented in the same CAPL program.
If the operation has been processed synchronously, the CAPL callback OnUdpSendTo is not called up (see also TcpSend).
Parameters
- socket: The socket handle.
- address: The numerical IPv4 address of the destination in network-byte order.
- ipv6Address: The destination IPv6 address in a 16 byte array.
- port: The port of the destination in host-byte order.
- buffer: The buffer containing the data to be sent.
- data: The struct containing the data to be sent.
- size: The size of the data to be sent.
- remoteEndpoint: The destination endpoint. IP address and port number must be specified.
- Example:
IP_Endpoint( 192.168.1.1:40001 )IP_Endpoint( [FC00::0001]:40001 )
- Example:
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. If the specific error code is 997, this just indicates asynchronous sending. All other results are sending errors.