UDPWrite
int UDPWrite (unsigned int channel, unsigned int destinationPort, const char *destinationAddress, void *outputBuffer, size_t writeSize);
Purpose
Writes a datagram to a destination port and address.
Specify the transmission mode of the write—unicast, multicast, or broadcast—in destinationAddress.
UDPWrite pushes the datagram to the network and returns immediately. There is no built-in notification or acknowledgement when a client receives the datagram.
Parameters
Input | ||||
Name | Type | Description | ||
channel | unsigned int | A handle that uniquely identifies an open UDP communication endpoint. | ||
destinationPort | unsigned int | The port number to which to send the datagram. The client application must be listening on the appropriate port to receive the datagram. |
||
destinationAddress | const char * | The IP address or host name to which to send the datagram. You can pass a string representing the IP address in dot-decimal notation, such as 127.0.0.1, or pass an alphanumeric string representing the host name, such as HAL9000. You can pass a multicast address (224.0.0.0 to 239.255.255.255) to send your datagram to all hosts that have subscribed to the multicast address. A channel can write to a multicast address without being subscribed to it. You can pass UDP_LAN_BROADCAST_ADDR to broadcast your datagram to all hosts on the LAN. You can direct broadcasts at specific subnets by passing an address that specifies the subnet address, with the variable octets set to 255. For example, given a class B subnet comprised of addresses of the form 172.16.x.x, if you send a datagram to 172.16.255.255, LabWindows/CVI delivers it to every host on that subnet.
|
||
writeSize | size_t | The number of bytes from outputBuffer to write. You must ensure that outputBuffer is at least as large as writeSize. This function returns an error if you pass a value greater than INT_MAX. The maximum datagram limit may be further limited by the system's UDP implementation. |
||
Output | ||||
Name | Type | Description | ||
outputBuffer | void * | A buffer containing the data to send. |
Return Value
Name | Type | Description |
status | int | Return value indicating whether the function was successful.
Zero indicates successful execution and a negative number indicates that an error occurred. Call the GetUDPErrorString function to obtain a message that describes the error. |
Additional Information
Library: UDP Support Library
Include file: udpsupp.h
LabWindows/CVI compatibility: LabWindows/CVI 8.5 and later