Avisaro Online Documentation - Wiki
Impressum Kontakt Sitemap

STREAM

Description

This command can be used to enable so-called "streaming" to and from an open file, TCP connection, UDP channel, standard or auxiliary I/O interface.

Parameters

STREAM needs one or two arguments. The first argument is the object (e.g. a file handle) that should be streamed. The streaming direction is determined by the capabilities of that object and how it was opened. The second, optional argument is the other end of the stream. If it is missing, all streams use the current selected I/O interface as default source or destination. While a stream is active, the command interface is blocked until the stream ends because all data has been transmitted, the stop sequence was found, or an error occurs that breaks the stream. Not all possible permutations are yet implemented. Those currently available are listed below:

Streaming from the current I/O interface into a file
If a file is opened for writing and after the STREAM command was invoked on this file, all data from the current I/O interface is streamed into the file. Streaming can only be cancelled if the stop sequence is inserted into the stream.

Streaming from a file to the current I/O interface
If a file is open for reading and after the STREAM command was invoked on this file, all data from the file is streamed to the I/O interface. Streaming is cancelled automatically if the last byte of the file was sent.

Bi-directional streaming to and from a TCP connection
If a TCP connection exists and after the STREAM command was invoked on this TCP connection, all incoming data from the TCP connection is routed to the I/O interface. Likewise, data from the I/O interface is sent simultaneously over the TCP connection. Streaming is cancelled automatically, when the TCP connection ends in any way or when a stop sequence is inserted on the I/O interface. If the socket is configured for TX delay, data is retarded for the specified time to collect bigger packets for better bandwidth utilization.

Bi-directional streaming to and from a UDP channel
If a UDP channel is open and after the STREAM command was invoked on this channel, all incoming data from the UDP channel is routed to the I/O interface. Data from the I/O interface can be sent simultaneously over the UDP channel. Because UDP is not connection oriented, the stream kan only be broken when a stop sequence is inserted on the I/O interface. If the socket is configured for TX delay, data is retarded for the specified time to collect bigger packets for better bandwidth utilization.

Streaming from the auxiliary RS232 interface into a file
If a file is opened for writing and after the STREAM command was invoked on this file using -4 as the second argument, all data from the auxiliary RS232 interface is streamed into the file. Streaming can only be cancelled if the stop sequence is inserted into the stream.

Streaming from the auxiliary IIC interface into a file
If a file is opened for writing and after the STREAM command was invoked on this file using -5 as the second argument, all data from the auxiliary IIC interface is streamed into the file. Streaming can only be cancelled if the stop sequence is inserted into the stream.

Streaming from the auxiliary IIC interface into a file but omit IIC stop conditions
If a file is opened for writing and after the STREAM command was invoked on this file using -6 as the second argument, all data from the auxiliary IIC interface is streamed into the file. Streaming can only be cancelled if the stop sequence is inserted into the stream.

Return Value

ERR_OK (0): if a stop sequence was used to cancel the stream, a TCP connection was gracefully closed or a file has streamed its last byte.
Any other value not equal to zero: An error occured. The meaning depends on which channels are used for streaming.

Example

STREAM 1 

Switch on streaming to or from a file that was opened as handle #1

Remarks

A stream can also be interrupted by closing the socket (see CLOSE) using the cmd page of the web interface: http://moduleaddress/cmd