Back to Adaptive Vision Library website

You are here: Start » Function Reference » TCP IP » TcpIp_WriteText

TcpIp_WriteText


Outputs a string through a connected TCP socket.

Syntax

void avl::TcpIp_WriteText
(
	avl::SocketId inSocket,
	const atl::String& inText,
	const atl::String& inSuffix
)

Parameters

Name Type Default Description
inSocket SocketId Connected socket ID.
inText const String& Text to send through socket.
inSuffix const String& \"\\\\r\\\\n\" Additional data to send, like a newline, escaped.

Description

This filter writes textual data to a connected socket.

The text from inText is sent through the connected socket, and if the inSuffix is given, it is sent after. Either parameter can be the empty string, but when both are empty, no data is sent through the socket. The text is sent using UTF-8 encoding.

The value on the inSuffix input can contain escape sequences.

An escaped string contains escape sequences, which are combinations of the \ (backslash) and another character, which have special meaning. The supported escape sequences are:

  • \r - carriage return (ASCII 13)
  • \n - new line (ASCII 10)
  • \t - tab character (ASCII 9)
  • \\ - verbatim backslash \

This filter can raise IoError when the connection is broken or closed by the other side, when the output buffer overflows because the other side is not receiving data or receiving data too slow, or when other network-related error occurred.

Hints

  • Connect inSocket with the output of TcpIp_Connect or TcpIp_Accept.
  • Connect the data you want to send to the inText input.
  • Additional suffix defined on inSuffix will be added at the end of sent chunk.

Multithreaded environment

This function is not guaranteed to be thread-safe. When used in multithreaded environment, it has to be manually synchronized.

See Also