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('',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



Specify a descriptive name for the TCP/IP object.


Specify the remote host.


Specify the remote host port for the connection.


Indicate the object type.

You can display the values of these properties for t.

ans = 
    [1x31 char]    [1x24 char]    [4000]    'tcpip'


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/

Communication Settings
   RemotePort:         4000
   Terminator:         'LF'

Communication State
   Status:             closed
   RecordStatus:       off

Read/Write State
   TransferStatus:     idle
   BytesAvailable:     0
   ValuesReceived:     0
   ValuesSent:         0