Contenuto principale

Questa pagina è stata tradotta con la traduzione automatica. Fai clic qui per vedere l’originale in inglese.

Interfaccia TCP/IP

Comunicazione tramite client e server TCP/IP

Il Transmission Control Protocol (TCP) è un protocollo di trasporto che si sovrappone all'Internet Protocol (IP) ed è uno dei protocolli di rete più utilizzati. Il supporto di 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 tramite socket di rete per connettersi a host remoti da MATLAB® per leggere e scrivere 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.

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

Funzioni

espandi tutto

Connessione e configurazione

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

Connessione e configurazione

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

Lettura e scrittura

readRead data sent to TCP/IP server
readlineRead line of ASCII string data sent to TCP/IP server
readbinblockRead one binblock of data sent to TCP/IP server
writeWrite data from TCP/IP server
writelineWrite line of ASCII data from TCP/IP server
writebinblockWrite one binblock of data from TCP/IP server
flushClear buffers for communication using TCP/IP server
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 ReceiveRicezione dei dati tramite rete TCP/IP da una macchina remota specificata.
TCP/IP SendSend data over TCP/IP network to specified remote machine

Argomenti

Comunicazione TCP/IP

Client TCP/IP

Server TCP/IP

Applicazione TCP/IP Explorer

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