Version: 4.4.7.0
Add secure Telnet, rsh, rexec and rlogin connectivity to any .NET application or service.
That specialized Read overloads will block until specified delimiters are found?
Automated scripted applications are easy to write, as specialized Read methods will continue receiving data until a specified delimiter is found, or the ReceiveTimout period has elapsed.
Code Sample:
private void automateSession(Telnet telnet)
{
    //Connect to the server
    telnet.Connect("myServer");

    //Login and marshal data to the UI thread
    telnet.Login("myUsername", "myPassword", "$");

    //Send a list command
    telnet.Write("ls -la\r");

    //Wait for prompt, marshal data to the UI thread
    telnet.Read("$");

    //Send an exit command; server will close the connection
    telnet.Write("exit\r");

    //Read any remaining data before the shutdown
    telnet.ReadToEnd();
}
Back to Top
That it is very easy to write code that executes asynchronously?
Components in the PowerTCP for .NET 4.x product line include Start and Marshal methods for easy execution on worker threads.
Code Sample:
//Start the process on a worker thread
telnet1.Start(automateSession, null);

...

private void automateSession(Telnet telnet, object notUsed)
{
    //This function executes on a worker thread, providing multi-threaded, asynchronous operation
    try
    {
        //Connect to the server
        telnet.Connect("myServer");

        //Login and marshal data to the UI thread
        telnet.Marshal(telnet.Login("myUsername", "myPassword", "$"));

        //Send a list command
        telnet.Write("ls -la\r");

        //Wait for prompt, marshal data to the UI thread
        telnet.Marshal(telnet.Read("$"));

        //Send an exit command; server will close the connection
        telnet.Write("exit\r");

        //Read any remaining data before the shutdown
        telnet.Marshal(telnet.ReadToEnd());
    }
    catch (Exception ex)
    {
        //Report errors to the UI thread
        telnet.Marshal(ex);
    }
}
Back to Top
That all data sent and received by the component is available in the Log event?
The Log event is a handy tool for debugging applications.  It fires whenever the component sends or receives data, and is perfect for adding logging capabilities to your application.
Code Sample:
private FileStream logFile = new FileStream(Application.StartupPath + "\\logFile.txt", FileMode.Append, FileAccess.Write);

private void myComponent_Log(object sender, LoggingEventArgs e)
{
    string prompt = (e.Data.Direction == Direction.In) ? "Recv: " : "Sent: ";
    logFile.Write(System.Text.Encoding.Default.GetBytes(prompt);
    logFile.Write(e.Data.Buffer, e.Data.Offset, e.Data.Count);
    logFile.Write(System.Text.Encoding.Default.GetBytes("\r\n");
}
Back to Top
That Option Negotiation can be easily customized?
Specifying which options should be negotiated with the telnet server is easy when the ClientOptions and ServerOptions collections are used.
Code Sample:
// Cause the client to refuse the TerminalType option if offered by the server
telnet1.ClientOptions.Remove(telnet1.ClientOptions[OptionCode.TerminalType]); 

// Request that server enable the Echo option
telnet1.ServerOptions.Add(new Option(OptionCode.Echo)); 

// Connect and login to the Telnet server 
telnet1.Login("myserver", "myusername", "mypassword", "$");
Back to Top