Main Content

Resolve TCP/IP Server Connection Errors

Issue

If you are unable to create a TCP/IP server using the tcpserver interface, follow these troubleshooting steps.

Possible Solutions

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

  • Check that the IP address you specify 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 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 =
    
        '208.80.154.224'
    
  • Make sure that you do not specify a port that is already in use. In addition, you can only create one server object for a given address and port combination. To see all TCP/IP ports in use, run the following command in MATLAB.

    !netstat -a -n -p TCP

See Also

Related Topics