Main Content

target.TCPChannel Class

Namespace: target

Describe TCP communication properties

Since R2020b

Description

Use the target.TCPChannel, which inherits functionality from target.CommunicationChannel, to describe TCP communication properties.

To create a target.TCPChannel object, use the target.create function.

Properties

expand all

IP address of the TCP server.

Attributes:

GetAccess
public
SetAccess
public

TCP port.

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

This code from Set Up PIL Connectivity by Using Target Framework (Embedded Coder) shows how to specify the connection between your development computer and target hardware. In the example, the target application runs on your development computer as a separate process and uses a TCP communication channel through localhost.

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';

Note

Using name-value arguments, you can create the connection object with this command:

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

Version History

Introduced in R2020b