dsp.UDPSender System object

Package: dsp

Send UDP packets to network

Description

The UDPSender object sends UDP packets to the network.

To send UDP packets to the network:

  1. Define and set up your UDP sender. See Construction.

  2. Call step to send the packets according to the properties of dsp.UDPSender. The behavior of step is specific to each object in the toolbox.

Construction

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.

Properties

RemoteIPAddress

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.

RemoteIPPort

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.

LocalIPPortSource

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.

LocalIPPort

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.

Methods

cloneCreate UDP sender object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs of step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
stepSend a UDP packet to network

Examples

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);

Algorithms

This object implements the algorithm, inputs, and outputs described on the UDP Send block reference page. The object properties correspond to the block parameters.

Was this topic helpful?