The SshWriteLine function writes a line of text to the
remote host and terminates the line with a carriage-return and
linefeed control character sequence. Unlike the SshWrite
function which writes arbitrary bytes of data to the server, this
function is specifically designed to write a single line of text
data from a null-terminated string.
There are some limitations when using SshWriteLine. The
function should only be used to send text, never binary data. In
particular, the function will discard nulls and append linefeed and
carriage return control characters to the data stream. The Unicode
version of this function will accept a Unicode string, however this
function does not support sending raw Unicode data to the remote
host. Unicode strings will be automatically converted to 8-bit
characters using the WideCharToMultiByte function and then
written as a stream of bytes.
This function will force the thread to block until the complete
line of text has been written, the write operation times out or the
remote host aborts the connection. If this function is called with
asynchronous events enabled, it will automatically switch the
client into a blocking mode, send the data and then restore the
client to asynchronous operation. If another network operation is
attempted while SshWriteLine is blocked sending data to the
remote host, an error will occur. It is recommended that this
function only be used with blocking (synchronous) connections; if
the application needs to establish multiple simultaneous
connections, it should create worker threads to manage each
connection.
The SshWrite and SshWriteLine function calls can
be safely intermixed.
Unlike the SshWrite function, it is possible for data to
have been written to the server if the return value is zero. For
example, if a timeout occurs while the function is waiting to send
more data to the remote host, it will return zero; however, some
data may have already been written prior to the error condition. If
this is the case, the lpnLength argument will specify the
number of characters actually written up to that point.