data =
flush (dev)
¶data =
flush (dev, "input")
¶data =
flush (dev, "output")
¶Flush the tcp socket buffers
dev - connected tcp device
If an additional parameter is provided of "input" or "output", then only the input or output buffer will be flushed
None
See also: serialport.
(tcp)
¶Flush the pending input, which will also make the BytesAvailable property be 0.
tcp - instance of octave_tcp class.
None.
See also: flushoutput.
(tcp)
¶Flush the output buffer.
tcp - instance of octave_tcp class.
None.
See also: flushinput.
res =
fopen (obj) (dummy)
¶Opens TCP connection obj
This currently is a dummy function to improve compatibility to MATLAB
numbytes =
fprintf (obj, template ...)
¶Writes formatted string template using optional parameters to TCP instrument
obj is a TCP object.
template Format template string
Number of characters written
data =
fread (obj)
¶data =
fread (obj, size)
¶data =
fread (obj, size, precision)
¶[data,count] =
fread (obj, ...)
¶[data,count,errmsg] =
fread (obj, ...)
¶Reads data from TCP instrument
obj is a TCP object.
size Number of values to read. (Default: 100).
precision precision of data.
data data read.
count values read.
errmsg read operation error message.
struct =
get (tcp)
¶field =
get (tcp, property)
¶Get the properties of tcp object.
tcp - instance of octave_tcp class.
property - name of property.
When property was specified, return the value of that property.
otherwise return the values of all properties as a structure.
See also: @octave_tcp/set.
set
(obj, property,value)
¶set
(obj, property,value,…)
¶Set the properties of tcp object.
If property is a cell so must be value, it sets the values of all matching properties.
The function also accepts property-value pairs.
Set the name for the tcp socket.
Set the remote host name for the tcp socket.
Set the remote port for the tcp socket.
Set the timeout value in seconds. Value of -1 means a blocking call.
None
See also: @octave_tcp/get.
tcp =
tcp ()
¶tcp =
tcp (ipaddress)
¶tcp =
tcp (ipaddress, port)
¶tcp =
tcp (ipaddress, port, timeout)
¶tcp =
tcp (ipaddress, [propertyname, propertyvalue])
¶tcp =
tcp (ipaddress, port, [propertyname, propertyvalue])
¶Open tcp interface.
ipaddress - the ip address of type String. If omitted defaults to ’127.0.0.1’.
port - the port number to connect. If omitted defaults to 23.
timeout - the interface timeout value. If omitted defaults to blocking call.
propname,propvalue - property name/value pairs.
Known input properties:
name value
Numeric timeout value or -1 to wait forever
The tcp() shall return instance of octave_tcp class as the result tcp.
The tcp object has the following public properties:
name assigned to the tcp object
instrument type ’tcp’ (readonly)
local port number (readonly)
remote port number
remote host
status of the object ’open’ or ’closed’ (readonly)
timeout value in seconds used for waiting for data
number of bytes currently available to read (readonly)
(tcp)
¶Close the interface and release a file descriptor.
tcp - instance of octave_tcp class.
None
[data, count] =
tcp_read (tcp, n, timeout)
¶Read from tcp interface.
tcp - instance of octave_tcp class.
n - number of bytes to attempt to read of type Integer
timeout - timeout in ms if different from default of type Integer
count - number of bytes successfully read as an Integer
data - data bytes themselves as uint8 array.
(tcp, timeout)
¶t =
tcp_timeout (tcp)
¶Set new or get existing tcp interface timeout parameter used for tcp_read() requests. The timeout value is specified in milliseconds.
tcp - instance of octave_tcp class.
timeout - tcp_read() timeout value in milliseconds. Value of -1 means a blocking call.
If timeout parameter is omitted, the tcp_timeout() shall return current timeout value as the result t.
n =
tcp_write (tcp, data)
¶Write data to a tcp interface.
tcp - instance of octave_tcp class.
data - data to be written to the tcp interface. Can be either of String or uint8 type.
Upon successful completion, tcp_write() shall return the number of bytes written as the result n.
tcp =
tcpip (host, [port], [PropertyName, PropertyValue...])
¶Matlab compatible wrapper to the tcp interface.
NOTE: tcpip has been deprecated. Use tcpclient instead
host - the host name or ip.
port - the port number to connect. If omitted defaults to 80.
PropertyName, PropertyValue - Optional property name, value pairs to set on the tcp object.
Currently the only known properties are "timeout" and "name".
tcpip will return an instance of octave_tcp class as the result.