Transmission Control Protocol (TCP) is a transport protocol layered on top of the Internet Protocol (IP) and is one of the most highly used networking protocols.
If you are having trouble connecting to or communicating with your server, try these troubleshooting tips.
TCP/IP is supported on these platforms:
The TCP/IP server interface is supported on the same platforms as MATLAB®. For updates to the list of currently supported platforms, see System Requirements.
Make sure you can create a TCP/IP server object. You create it using the
tcpserver function, which takes a port number and an
optional IP address as inputs. If you do not specify an IP address, the server
can accept a client connection at any valid IP address. The IP address that you
specify for the server should match the IP address that the client connects
t = tcpserver("172.28.200.145",4000);
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.
If you specify a host name instead of host IP address, you can also
verify that it is a valid host name by using
resolvehost. If the output is empty, the
specified host name is invalid.
ans = '172.28.200.145'
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.
Make sure that your network adapter is enabled and connected.
Before reading from or writing to the server object, check the
Connected property to make sure that a client is
connected to it. If a client has successfully connected, the value of
this property is
properties also provide information about the client that is connected
to the server object. The value of
should match the value of
Make sure the correct data type, such as
double is being
write. Use the
same data type as the client. If reading and writing data types other
int8, make sure the
ByteOrder is correct.