Resolve TCP/IP Client Connection Errors
If you are unable to create a TCP/IP client using the
interface, follow these troubleshooting steps.
Check IP Address and Port
If your instrument supports TCP socket communication by allowing control and communication on a static TCP/IP port, the port number is typically set by the manufacturer. However, you might need to enable a TCP socket server on the instrument. Run the following commands in MATLAB® with your remote host IP address or host name and port. In this example, the remote host IP address is
192.168.1.111and port is
Check that the IP address or host name you specified can be reached.
Check that the port is accessible using Telnet or another application that supports Telnet, such as PuTTY.
!telnet 192.168.1.111 4000
Verify that the specified IP address or host name is valid by using
resolvehost. If the output is empty, the specified IP address or host name is invalid. For example, if the host name is
en.wikipedia.org, run the following.
[name,address] = resolvehost("en.wikipedia.org")
name = 'en.wikipedia.org' address = '126.96.36.199'
Make sure that you specified the correct port number. Refer to your instrument manual or contact your instrument manufacturer to check the port number.
Check that a TCP socket server is listening at the specified port. For example, on certain Tektronix® oscilloscope models, you might have to enable the socket server, which is a feature provided by TekVISA running on the instrument itself and can provide a raw TCP connection for instrument control.
Use a third-party TCP/IP communication software, such as PuTTY, to check that you can access the specified IP address and port from other software.
Check Network Connection
Make sure that your network connection is configured properly.
Make sure that your network adapter is enabled and connected.
If the instrument has a built-in PC running the TCP socket server, check if a firewall on the instrument's PC is blocking communication.
Check if a firewall on the client computer is blocking communication.
Some instruments and servers (such as
tcpserverobjects) allow only one connection. Make sure that the instrument or server is not already connected to another client.