3.11 TCP Client

3.11.1 @octave_tcpclient/configureTerminator

Function File: configureTerminator (tcp, term)
Function File: configureTerminator (tcp, readterm, writeterm)

Set terminator on a tcpclient object for ASCII string manipulation

Inputs

tcp - tcpclient object
term - terminal value for both read and write
readterm = terminal value type for read data
writeterm = terminal value for written data

The terminal can be either strings "cr", "lf" (default), "lf/cr" or an integer between 0 to 255.

Outputs

None

See also: tcpport.

3.11.2 @octave_tcpclient/flush

: data = flush (dev)
: data = flush (dev, "input")
: data = flush (dev, "output")

Flush the tcpclient socket buffers

Inputs

dev - connected tcpclient device

If an additional parameter is provided of "input" or "output", then only the input or output buffer will be flushed

Outputs

None

See also: serialport.

3.11.3 @octave_tcpclient/get

Function File: struct = get (tcpclient)
Function File: field = get (tcpclient, property)

Get the properties of tcpclient object.

Inputs

tcpclient - instance of octave_tcpclient class.
property - name of property.

Outputs

When property was specified, return the value of that property.
otherwise return the values of all properties as a structure.

See also: @octave_tcpclient/set.

3.11.4 @octave_tcpclient/read

Function File: data = read (obj)
Function File: data = read (obj, size)
Function File: data = read (obj, size, datatype)

Reads data from TCP instrument

Inputs

obj is a TCP object.
size Number of values to read. (Default: NumBytesAvailable).
datatype datatype of data.

Outputs

data data read.

3.11.5 @octave_tcpclient/set

Function File: set (obj, property,value)
Function File: set (obj, property,value,…)

Set the properties of tcpclient object.

Inputs

If property is a cell so must be value, it sets the values of all matching properties.

The function also accepts property-value pairs.

Properties

’Name’

Set the name for the tcpclient socket.

’UserData’

Set user data for the tcpclient socket.

’Timeout’

Set the timeout value in seconds. Value of -1 means a blocking call.

Outputs

None

See also: @octave_tcpclient/get.

3.11.6 @octave_tcpclient/write

Function File: numbytes = write (obj, data)
Function File: numbytes = write (obj, data, datatype)

Writes data to TCP instrument

Inputs

obj is a TCPclient object.
data data to write.
datatype datatype of data. If not specified, it defaults to "uint8".

Outputs

returns number of bytes written.

3.11.7 tcpclient

Loadable Function: tcpclient = tcpclient (ipaddress, port)
Loadable Function: tcpclient = tcpclient (ipaddress, port, [propertyname, propertyvalue])

Open tcpclient interface.

Inputs

ipaddress - the ip address of type String.
port - the port number to connect.
propname,propvalue - property name/value pairs.

Known input properties:

Name

name value

Timeout

Numeric timeout value or -1 to wait forever

EnableTransferDelay

Boolean to enable or disable the nagle algorithm for delay transfer.

UserData

User data value.

Outputs

The tcpclient() shall return instance of octave_tcpclient class as the result tcpclient.

Properties

The tcpclient object has the following public properties:

Name

name assigned to the tcpclient object

Type

instrument type ’tcpclient’ (readonly)

Port

remote port number (Readonly)

Address

remote host address (Readonly)

Status

status of the object ’open’ or ’closed’ (readonly)

Timeout

timeout value in seconds used for waiting for data

NumBytesAvailable

number of bytes currently available to read (readonly)

NumBytesWritten

number of bytes currently available to read (readonly)

ByteOrder

Byte order for data (currently not used)

Terminator

Terminator value used for string data (currently not used)

UserData

User data

EnableTransferDelay

Bool for whether transfer delay is enabled. (Read only)