Send UDP packets to network
The UDPSender object sends UDP packets to the network.
To send UDP packets to the network:
H = dsp.UDPSender returns a UDP sender object, H, that sends UDP packets to a specified port.
H = dsp.UDPSender('PropertyName',PropertyValue, ...) returns a UDP sender object, H, with each property set to the specified value.
Remote address to which to send data
Specify the remote (i.e., host) IP address to which the data is sent. The default is '127.0.0.1', which is the local host.
Remote port to which to send data
Specify the port at the remote IP address to which the data is sent. The default is 25000.
Source of the LocalIPPort property
Specify how to determine the port on the host as | Auto | Property |. If you specify Auto, the object selects the port dynamically from the available ports. If you specify Property, the object uses the source specified in the LocalIPPort property. The default is Auto.
Local port from which to send data
Specify the port from which to send data. This property applies when you set the LocalIPPortSource property to Auto. The default is 25000.
|clone||Create UDP sender object with same property values|
|getNumInputs||Number of expected inputs to step method|
|getNumOutputs||Number of outputs of step method|
|isLocked||Locked status for input attributes and nontunable properties|
|release||Allow property value and input characteristics changes|
|step||Send a UDP packet to network|
Send a number of UDP packets, and calculate the number of successfully transmitted bytes:
hudpr = dsp.UDPReceiver; hudps = dsp.UDPSender; bytesSent = 0; bytesReceived = 0; dataLength = 128; for k = 1:20 dataSent = uint8(255*rand(1,dataLength)); bytesSent = bytesSent + dataLength; step(hudps, dataSent); dataReceived = step(hudpr); bytesReceived = bytesReceived + length(dataReceived); end release(hudps); release(hudpr); fprintf('Bytes sent: %d\n', bytesSent); fprintf('Bytes received: %d\n', bytesReceived);
This object implements the algorithm, inputs, and outputs described on the UDP Send block reference page. The object properties correspond to the block parameters.