Transmission Control Protocol (TCP) is a transport protocol layered on top of the Internet Protocol (IP) and is one of the most used networking protocols. Instrument Control Toolbox™ support for TCP/IP communication includes the ability to create clients and servers. TCP/IP client support enables you to use network socket communication to connect to remote hosts from MATLAB® for reading and writing both binary and ASCII data. TCP/IP server support enables you to create a network socket for communication between MATLAB and a single client.
Use tcpclient
to create a TCP/IP client that connects to a server or hardware and perform read and write
operations. Use tcpip
to create a TCP/IP
server.
Query Instrument | Query or read instrument data |
To Instrument | Send simulation data to instrument |
TCP/IP Receive | Receive data over TCP/IP from specified remote machine |
TCP/IP Send | Send data over TCP/IP to specified remote machine |
Use network socket communication to connect to remote hosts from MATLAB for reading and writing data over TCP/IP.
Compare the TCP/IP and UDP protocols to determine which to use.
Create TCP/IP Client and Configure Settings
Connect to remote hosts or hardware from MATLAB for reading and writing data over TCP/IP.
Write and Read Data over TCP/IP Interface
Write and read data to and from the remote host connected to the
tcpclient
object.
Use Callbacks for TCP/IP Communication
Enhance TCP/IP communication by executing a callback function when a specified event occurs.
Transition Your Code to tcpclient Interface
Connect to serial port devices using tcpclient
instead of
tcpip
.
Communicate Using TCP/IP Server Sockets
Support for Server Sockets is available for a single remote connection. You can use this connection to communicate between a client and MATLAB, or between two instances of MATLAB.
Troubleshooting TCP/IP Communication
Troubleshoot the TCP/IP interface.
Resolve TCP/IP Client Warning: Unable to Read Any Data
Troubleshoot when you receive no data and you get the warning message: 'tcpclient' unable to read any data.