主要内容

target.TCPChannel 类

命名空间: target

描述 TCP 通信属性

描述

使用从 target.CommunicationChannel 继承功能的 target.TCPChannel 来描述 TCP 通信属性。

要创建 target.TCPChannel 对象,请使用 target.create 函数。

属性

全部展开

TCP 服务器的 IP 地址。

特性:

GetAccess
public
SetAccess
public

TCP 端口。

特性:

GetAccess
public
SetAccess
public

示例

全部折叠

以下代码来自Set Up PIL Connectivity by Using Target Framework,显示如何指定开发计算机和目标硬件之间的连接。在该示例中,目标应用程序作为单独进程在开发计算机上运行,并通过 localhost 使用 TCP 通信通道。

connection = target.create('TargetConnection');
connection.Name = 'Host Process Connection';
connection.Target = hostTarget;
connection.CommunicationChannel = target.create('TCPChannel');
connection.CommunicationChannel.Name = ...
                   'External Process TCPCommunicationChannel';
connection.CommunicationChannel.IPAddress = 'localhost';
connection.CommunicationChannel.Port = '0';

注意

使用名称-值参量,您可以通过以下命令创建连接对象:

connection = target.create('TargetConnection', ...
                      'Name', 'Host Process Connection', ...
                      'Target', hostTarget, ...
                      'CommunicationType', 'TCPChannel', ...
                      'IPAddress', 'localhost', ... 
                      'Port', '0')

版本历史记录

在 R2020b 中推出