メインコンテンツ

このページは機械翻訳を使用して翻訳されました。最新版の英語を参照するには、ここをクリックします。

TCP/IP インターフェース

TCP/IPクライアントとサーバーを使用した通信

伝送制御プロトコル (TCP) は、インターネット プロトコル (IP) の上に階層化されたトランスポート プロトコルであり、最もよく使用されるネットワーク プロトコルの 1 つです。Instrument Control Toolbox™ の TCP/IP 通信サポートには、クライアントとサーバーを作成する機能が含まれています。TCP/IP クライアント サポートにより、ネットワーク ソケット通信を使用して MATLAB® からリモート ホストに接続し、バイナリ データと ASCII データの両方を読み書きできるようになります。TCP/IP サーバー サポートにより、MATLAB と単一のクライアント間の通信用のネットワーク ソケットを作成できます。

tcpclient を使用して、サーバーまたはハードウェアに接続し、読み取りおよび書き込み操作を実行する TCP/IP クライアントを作成します。tcpserver を使用して TCP/IP サーバーを作成します。

関数

すべて展開する

接続と設定

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 (R2024a 以降)

読み取りと書き込み

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

接続と設定

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

読み取りと書き込み

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

アプリ

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

ブロック

TCP/IP Receive指定されたリモートマシンからTCP/IPネットワーク経由でデータを受信します
TCP/IP SendSend data over TCP/IP network to specified remote machine

トピック

TCP/IP通信

TCP/IP クライアント

TCP/IP サーバー

TCP/IP エクスプローラー アプリ

トラブルシューティング

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.

注目の例