3.12 TCP Server

3.12.1 @octave_tcpserver/configureTerminator

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

Set terminator on a tcpserver object for ASCII string manipulation

Inputs

tcp - tcpserver 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.12.2 @octave_tcpserver/flush

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

Flush the tcpserver socket buffers

Inputs

dev - connected tcpserver 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.12.3 @octave_tcpserver/get

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

Get the properties of tcpserver object.

Inputs

tcpserver - instance of octave_tcpserver 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_tcpserver/set.

3.12.4 @octave_tcpserver/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 Server object.
size Number of values to read. (Default: NumBytesAvailable).
datatype datatype of data.

Outputs

data data read.

3.12.5 @octave_tcpserver/set

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

Set the properties of tcpserver 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 tcpserver socket.

’UserData’

Set user data for the tcpserver socket.

’Timeout’

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

Outputs

None

See also: @octave_tcpserver/get.

3.12.6 @octave_tcpserver/write

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

Writes data to TCP instrument

Inputs

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

Outputs

returns number of bytes written.

3.12.7 tcpserver

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

Open tcpserver interface.

Inputs

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

Known input properties:

Name

name value

Timeout

Numeric timeout value or -1 to wait forever

UserData

User data value.

Outputs

The tcpserver() shall return instance of octave_tcpserver class as the result tcpserver.

Properties

The tcpserver object has the following public properties:

Connected

boolean flag for when connected to a client (Readonly)

ClientPort

connected client port number (Readonly)

ClientAddress

connected client address (Readonly)

Name

name assigned to the tcpserver object

Type

instrument type ’tcpserver’ (readonly)

ServerPort

server port number (Readonly)

ServerAddress

server 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