This library contains three Telnet-Server implementations:
This source-code depends on Netbits.Common!.

 

  1. BasicTelnetClientSession

    This is the base implementation of a telnet-server. 
    Following RFC's are implemented 

    RFC 727 (Telnet Logout)
    RFC 854 (Telnet Protocol)
    RFC 855 (Telnet Options)
    RFC 857 (Telnet Echo)
    RFC 858 (Telnet Suppress Go Ahead)
    RFC 1073 (Telnet Option WindowSize)
    RFC 1184 (LineMode Option) partial implemented.
    RFC 1572 (Telnet Option environment)

    How to use:

    First create a class like "TelnetClient" that inherit BasicTelnetClientSession
    Override "_HandleChar"

    class TelnetClient : BasicTelnetClientSession
    {
        public TelnetClient( System.Net.Sockets.TcpClient Client_ ) : base( Client_ )
        {
            base.Echoed = false;
            base.LineMode = true;
            base.SuppressGoAhead = true;
            base.WindowSize = true;
        }

        protected override void _HandleChar( byte Char_ )
        {
            Console.WriteLine( "handle char {0}", Char_ );
        }

        protected override void _HandleWindowSize( int Width_, int Height_ )
        {
            Console.WriteLine( "handle window-size width:{0}, height:{1}", Width_, Height_ );
        }
    }

    Now create the TCP-Server with client-session-type "TelnetClient"

    TcpServer<TelnetClient> server = new TcpServer<TelnetClient>( "my-simple-telnet-server" );
    server.EndPoints = new BindEndPoint( "127.0.0.1:9876" );
    server.Start();



  2. TerminalTelnetClientSession

    This type of TelnetClientSession is an linux-terminal implementation. 
    This handle escape sequences, colors and attributes.

    How to use: 

    First create a class like "TelnetClient" that inherit from TerminalTelnetClientSession
    Override "_HandleKey" and "_HandleAscii"

    class TelnetClient : TerminalTelnetClientSession
    {
        public TelnetClient( System.Net.Sockets.TcpClient Client_ ) : base( Client_ )
        {
            base.Echoed = false;
            base.LineMode = true;
            base.SuppressGoAhead = true;
            base.WindowSize = true;
        }

        protected override void _HandleAscii( byte Key_ )
        {
            Console.WriteLine( "handle ASCII-char {0}", Key_ );
        }

        protected override void _HandleKey( Netbits.TelnetServer.Enums.EnumTelnetKeys Key_ )
        {
            Console.WriteLine( "handle KEY {0}", Key_.ToString() );
        }

        protected override void _HandleWindowSize( int Width_, int Height_ )
        {
            Console.WriteLine( "handle window-size width:{0}, height:{1}", Width_, Height_ );
        }
    }


    Now create the TCP-Server with client-session-type "TelnetClient"

    TcpServer<TelnetClient> server = new TcpServer<TelnetClient>( "my-simple-telnet-server" );
    server.EndPoints = new BindEndPoint( "127.0.0.1:9876" );
    server.Start();



  3. NetbitsTelnetClientSession (comes immediately)


 

 

 

Last edited Oct 31, 2013 at 8:47 AM by mjungwirth, version 1