Caution: The Telnet protocol transmits all data, including
login credentials, in plaintext and does not provide any inherent
encryption. While this library supports optional TLS connections for
Telnet, secure Telnet servers are rare in practice. This protocol is
still supported for compatibility with legacy systems, but it is
strongly recommended that you use secure protocols such as SSH
whenever possible, especially when connecting over public or untrusted
networks. To establish a secure connection to the server using the
Secure Shell (SSH) protocol, use the
CSshClient class.
This method will block the current thread until a connection has
been established or the timeout period has elapsed. To prevent it from
blocking the main user interface thread, the application should create
a background worker thread and establish a connection by calling the
Connect method in that thread. If the application
requires multiple simultaneous connections, it is recommended you
create a worker thread for each connection.
The dwOptions argument can be used to specify the threading
model that is used by the library when a connection is established.
By default, the class instance is initially attached to the thread
that created it. From that point on, until the handle is released, only
the owner may call methods using that instance of the class. The
ownership of the class instance may be transferred from one thread to
another using the AttachThread method.
Specifying the TELNET_OPTION_FREETHREAD option enables any thread
to call any method in that instance of the class, regardless of which
thread created it. It is important to note that this option disables
certain internal safety checks which are performed by the library and
may result in unexpected behavior unless access to the class instance
is synchronized. If one thread calls a function in the library, it
must ensure that no other thread will call another function at the
same time using the same instance.