Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Create a TCP/IP Object

TCP/IP Object

You create a TCP/IP object with the tcpip function. tcpip requires the name of the remote host as an input argument. In most cases, you need to specify the remote port value. If you do not specify the remote port, then 80 is used. As described in Configuring Properties During Object Creation, you can also configure property values during object creation.

Each TCP/IP object is associated with one instrument. For example, to create a TCP/IP object for a Sony/Tektronix® AWG520 Arbitrary Waveform Generator,

t = tcpip('sonytekawg.yourdomain.com',4000);

Note that the port number is fixed and is found in the instrument's documentation.

The TCP/IP object t now exists in the MATLAB® workspace. You can display the class of t with the whos command.

whos t
  Name      Size                   Bytes  Class

  t         1x1                      640  tcpip object

Grand total is 16 elements using 640 bytes

Once the TCP/IP object is created, the following properties are automatically assigned values. These general-purpose properties provide information about the TCP/IP object based on the object type, the remote host, and the remote port.

TCP/IP Descriptive Properties

Property Name

Description

Name

Specify a descriptive name for the TCP/IP object.

RemoteHost

Specify the remote host.

RemotePort

Specify the remote host port for the connection.

Type

Indicate the object type.

You can display the values of these properties for t.

get(t,{'Name','RemoteHost','RemotePort','Type'})
ans = 
    [1x31 char]    [1x24 char]    [4000]    'tcpip'

    Note:   To get a list of options you can use on a function, press the Tab key after entering a function on the MATLAB command line. The list expands, and you can scroll to choose a property or value. For information about using this advanced tab completion feature, see Using Tab Completion for Functions.

TCP/IP Object Display

The TCP/IP object provides you with a convenient display that summarizes important configuration and state information. You can invoke the display summary these three ways:

  • Type the TCP/IP object variable name at the command line.

  • Exclude the semicolon when creating a TCP/IP object.

  • Exclude the semicolon when configuring properties using the dot notation.

You can also display summary information via the Workspace browser by right-clicking an instrument object and selecting Display Summary from the context menu.

The display summary for the TCP/IP object t is given below.

TCP/IP Object : TCP/IP-sonytekawg.yourdomain.com

Communication Settings
   RemotePort:         4000
   RemoteHost:         sonytekawg.yourdomain.com
   Terminator:         'LF'

Communication State
   Status:             closed
   RecordStatus:       off

Read/Write State
   TransferStatus:     idle
   BytesAvailable:     0
   ValuesReceived:     0
   ValuesSent:         0
Was this topic helpful?