Use the TCP/IP and UDP interfaces for reading and writing both
binary data and ASCII data. You use different functions for the different
data types – fprintf
and fscanf
for
ASCII operations, and fread
and fwrite
for
binary data. You can also do asynchronous operations using other functions.
Create a TCP/IP object to establish a connection between MATLAB® and the remote host.
TCP/IP Communication with a Remote Host
These are the minimum steps required to communicate with a remote host over TCP/IP.
Rules for Completing Read and Write Operations over TCP/IP and UDP
The rules for completing synchronous and asynchronous read and write operations are described here.
Basic Workflow to Read and Write Data over TCP/IP
This example illustrates how to use text and binary read and write operations with a TCP/IP object connected to a remote instrument.
Read and Write ASCII Data over TCP/IP
This section provides details and examples exploring ASCII read and write operations with a TCP/IP object.
Read and Write Binary Data over TCP/IP
This section provides details and examples exploring binary read and write operations with a TCP/IP object.
Asynchronous Read and Write Operations over TCP/IP
This section provides details and examples exploring asynchronous read and write operations with a TCP/IP object.
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.
Create a UDP object to establish a connection between MATLAB and the remote host.
UDP Communication Between Two Hosts
These are the minimum steps required to communicate between two hosts over UDP.
Rules for Completing Read and Write Operations over TCP/IP and UDP
The rules for completing synchronous and asynchronous read and write operations are described here.
Basic Workflow to Read and Write Data over UDP
This example shows the basic workflow of text read and write operations with a UDP object connected to a remote instrument.
Read and Write ASCII Data over UDP
This section provides details and examples exploring ASCII read and write operations with a UDP object.
Read and Write Binary Data over UDP
This section provides details and examples exploring binary read and write operations with a UDP object.
Asynchronous Read and Write Operations over UDP
This section provides details and examples exploring asynchronous read and write operations with a UDP object.
Transmission Control Protocol (TCP or TCP/IP) and User Datagram Protocol (UDP or UDP/IP) are both transport protocols layered on top of the Internet Protocol (IP). The two protocols are compared here.
Enhance your instrument communication using events and callbacks.
Instrument Control Toolbox Properties
These properties are available in the toolbox.
Troubleshooting TCP/IP Interface
Try these tips if you have problems using the toolbox with the TCP/IP interface. Includes information about TCP/IP supported platforms, configuration and connection, and other interface-specific tips.
Try these tips if you have problems using the toolbox with the UDP interface. Includes information about UDP supported platforms and configuration and connection.