Main Content

UDP Warning - Unable to Read Any Data

These remedies apply to the case when you receive no data and you get this warning message:

'udp' unable to read any data

ASCII and Binary Data

When using the UDP interface for:

  • Reading ASCII (text) data using the fscanf, fgets, or fgetl functions

  • Reading binary data using the fread function

these are possible causes and remedies:

CauseSolution
An invalid command was sent to the device, so there is a problem reading the response to the command.Check your device manual for proper command formatting.
The device did not receive the command because of an incorrect UDP RemotePort value.Verify that the UDP RemotePort value is set to the port number the device is listening on. For more information about setting the remote port, see udp and Create a UDP Object and View Properties.
A firewall is blocking incoming UDP packets.Verify that your system firewall setting allows connections to 'LocalPort'.
The UDP packet size is larger than the maximum packet size that can be handled by the Ethernet adaptor.The UDP packet size is controlled by the OutputDatagramPacketSize property. You can specify the size, in bytes, between 1 and 65,535, and the default value is 512.
You might need to enable port sharing.If you are receiving UDP broadcasts on a shared port, set the EnablePortSharing property to on. For the syntax, see "Enable Port Sharing Over UDP" in Create a UDP Object and View Properties.

Binblock Data

When using the UDP interface for:

  • Reading binblock (binary-block) data using the binblockread function

these are possible causes and remedies:

CauseSolution
An incorrect write terminator was sent to the instrument before attempting to read data, so there is no data to read.Verify that the Terminator property is set to the value required by your device.
An invalid command was sent to the device, so there is a problem reading the response to the command.Check your device manual for proper command formatting.
The device did not receive the command because of an incorrect UDP RemotePort value.Verify that the UDP RemotePort value is set to the port number the device is listening on. For more information about setting the remote port, see udp and Create a UDP Object and View Properties.
A firewall is blocking incoming UDP packets.Verify that your system firewall setting allows connections to 'LocalPort'.
The UDP packet size is larger than the maximum packet size that can be handled by the Ethernet adaptor.The UDP packet size is controlled by the OutputDatagramPacketSize property. You can specify the size, in bytes, between 1 and 65,535, and the default value is 512.
You might need to enable port sharing.If you are receiving UDP broadcasts on a shared port, set the EnablePortSharing property to on. For the syntax, see "Enable Port Sharing Over UDP" in Create a UDP Object and View Properties.
If the amount of data being received spans multiple UDP packets, it is possible that the system dropped packets.The UDP packet size is controlled by the OutputDatagramPacketSize property. You can specify the size, in bytes, between 1 and 65,535, and the default value is 512. You can increase or decrease the packet size if necessary.

More Troubleshooting Help

For more information about troubleshooting the UDP interface, including supported platforms, adaptor requirements, configuration and connection, and other troubleshooting tips, see Troubleshooting UDP Interface.