Main Content

Resolve UDP Port Connection Errors

Issue

If you are unable to connect to a UDP socket using the udpport interface, follow these troubleshooting steps.

Possible Solutions

  • Make sure that your network adapter is enabled and connected.

  • Make sure that you do not specify a local port that is already in use. In addition, you can only create one udpport object for a given host and port combination. To see all local ports in use, run the following command in MATLAB®.

    !netstat -a -n -p UDP

  • If you are using the same port for multiple UDP sockets, make sure that port sharing is enabled for the specified port.

  • If you specified LocalHost as a name-value argument, make sure that it represents your computer's host name or IP address that you want to listen on for incoming UDP packets. If you want to specify the host name or address to send packets to, specify it in the write (byte-type and datagram-type udpport objects) or writeline (byte-type udpport objects) functions.

  • If you specified a local host, check that the local host IP address is available on your machine. To see valid IP addresses for your machine, run the following command in MATLAB on Windows®.

    !ipconfig

    On Linux® and macOS, run the following command.

    !ifconfig

  • Verify that the specified local host name is valid by using resolvehost.

See Also

Related Topics