Contenuto principale

Questa pagina è stata tradotta con la traduzione automatica. Fai clic qui per vedere l'ultima versione in inglese.

Interfaccia TCP/IP

Comunicazione tramite client e server TCP/IP

Il Transmission Control Protocol (TCP) è un protocollo di trasporto sovrapposto al protocollo Internet (IP) ed è uno dei protocolli di rete più utilizzati. Il supporto Instrument Control Toolbox™ per la comunicazione TCP/IP include la possibilità di creare client e server. Il supporto client TCP/IP consente di utilizzare la comunicazione socket di rete per connettersi a host remoti da MATLAB® per la lettura e la scrittura di dati sia binari che ASCII. Il supporto del server TCP/IP consente di creare un socket di rete per la comunicazione tra MATLAB e un singolo client.

Utilizzare tcpclient per creare un client TCP/IP che si connette a un server o hardware ed esegue operazioni di lettura e scrittura. Utilizzare tcpserver per creare un server TCP/IP.

Funzioni

espandi tutto

Connetti e configura

tcpclientCreate TCP/IP client connection with TCP/IP server
configureTerminatorSet terminator for ASCII string communication with remote host over TCP/IP
configureCallbackSet callback function and trigger condition for communication with remote host over TCP/IP
tcpclientfindFind TCP/IP client connections (Da R2024a)

Lettura e scrittura

readRead data from remote host over TCP/IP
readlineRead line of ASCII string data from remote host over TCP/IP
readbinblockRead one binblock of data from remote host over TCP/IP
writeWrite data to remote host over TCP/IP
writelineWrite line of ASCII data to remote host over TCP/IP
writebinblockWrite one binblock of data to remote host over TCP/IP
writereadWrite command to remote host over TCP/IP and read response
flushClear buffers for communication with remote host over TCP/IP

Connetti e configura

tcpserverCreate TCP/IP server (Da R2021a)
configureTerminatorSet terminator for ASCII string communication (Da R2021a)
configureCallbackSet callback function and trigger condition for communication (Da R2021a)
tcpserverfindFind TCP/IP servers (Da R2024a)

Lettura e scrittura

readRead data sent to TCP/IP server (Da R2021a)
readlineRead line of ASCII string data sent to TCP/IP server (Da R2021a)
readbinblockRead one binblock of data sent to TCP/IP server (Da R2021a)
writeWrite data from TCP/IP server (Da R2021a)
writelineWrite line of ASCII data from TCP/IP server (Da R2021a)
writebinblockWrite one binblock of data from TCP/IP server (Da R2021a)
flushClear buffers for communication using TCP/IP server (Da R2021a)
resolvehostResolve network host name or IP address
echotcpipStart or stop TCP/IP echo server

App

TCP/IP ExplorerConnect to and communicate with TCP/IP server (Da R2021b)

Blocchi

TCP/IP ReceiveRicevere dati tramite rete TCP/IP dalla macchina remota specificata
TCP/IP SendSend data over TCP/IP network to specified remote machine

Argomenti

Comunicazione TCP/IP

Cliente TCP/IP

Server TCP/IP

Applicazione di esplorazione TCP/IP

Risoluzione dei problemi

Troubleshooting TCP/IP Client Interface

Troubleshoot the TCP/IP client interface.

Resolve TCP/IP Client Connection Errors

Troubleshoot creating a TCP/IP client.

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.

Troubleshooting TCP/IP Server Interface

Troubleshoot the TCP/IP server interface.

Resolve TCP/IP Server Connection Errors

Troubleshoot creating a TCP/IP server.

Resolve TCP/IP Server Warning: Unable to Read Any Data

Troubleshoot when you receive some data and you get the warning message: 'tcpserver' unable to read any data.

Resolve TCP/IP Server Warning: Unable to Read All Data

Troubleshoot when you receive some data and you get the warning message: 'tcpserver' unable to read all requested data.

Esempi in primo piano