Results 1 to 8 of 8

Thread: Free C# (or general .NET) Telnet Library?

  1. #1
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,508
    Thanks
    336
    Thanked
    320 times in 255 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre

    Free C# (or general .NET) Telnet Library?

    I am writing a small app to connect to our local unix servers and run a few commands, read the response and output it in a windows form.

    The problem is that microsoft didn't include any telnet libraries with .net, or ssh for that matter. I *could* spend a week or two writing my own basic library, and ultimately this is the best way as I only have to give it the features I need; but I know next to nothing about .net socket programming and am on a time limit for this, so an off-the-shelf library is my best option for now.

    So, anyone know of any decent ones that a free/open source? I have found a few that seem fairly competent, but as usual with free ones the documentation is either rubbish or none-existent, and they seem fairly complex to use.

    I am currently working with this one: http://www.klausbasan.de/misc/telnet/index.html

    which is very promising, I have managed to login to a server from it, but get stuck reading back the output from commands (even basic ones like "pwd")

    I will keep going and get it working in the end, but does anyone know of a better library? even better if you have actually used it

    Cheers for any help,

    Spud/Pete

  2. #2
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,168
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts
    i remeber a code project artical a few months back!

    http://www.codeproject.com/csharp/terminalcontrol.asp

    sounds as thou it might be able to help you a bit.
    throw new ArgumentException (String, String, Exception)

  3. #3
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,508
    Thanks
    336
    Thanked
    320 times in 255 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre
    Yeah thats pretty cool thanks

    I have managed to adapt the code from the one I linked to above to get back an output from my commands (by filling the buffer with the entire contents of the shell screen [40 lines] and then reading that into an array and parsing it line by line), but i'm sure there could be a better way of doing it.

    The problem seems to be that most of the libries are designed around a terminal emulator app - ie they are designed to provide a telnet client like interface (like putty or windows telnet), whereas I want more of a reflection style send a command, get a response type.

    I will have another play when I get to work tomorrow and see
    Last edited by Spud1; 11-05-2006 at 08:34 PM.

  4. #4
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts
    Possibly round-a-bout but couldn't the app connect to a web server on the machine that could in turn run the commands.
    To err is human. To really foul things up ... you need a computer.

  5. #5
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,508
    Thanks
    336
    Thanked
    320 times in 255 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre
    not in this case no

    It is designed to run a status check for our documentum docbases (think of them like databases) on each of our unix servers, by running a shell script I created on each server. We can't run web-servers on them for various business reasons, so telnet or ssh is our only option really (as this app also needs to be able to run on any windows XP machine wiht .net 1.1 or higher, so has to use standard stuff.)

    I will get it working though, it's a fun challange Maybe i will even do my own telnet library one day, if i get time to learn how to use sockets in C#

  6. #6
    Comfortably Numb directhex's Avatar
    Join Date
    Jul 2003
    Location
    /dev/urandom
    Posts
    17,074
    Thanks
    228
    Thanked
    1,027 times in 678 posts
    • directhex's system
      • Motherboard:
      • Asus ROG Strix B550-I Gaming
      • CPU:
      • Ryzen 5900x
      • Memory:
      • 64GB G.Skill Trident Z RGB
      • Storage:
      • 2TB Seagate Firecuda 520
      • Graphics card(s):
      • EVGA GeForce RTX 3080 XC3 Ultra
      • PSU:
      • EVGA SuperNOVA 850W G3
      • Case:
      • NZXT H210i
      • Operating System:
      • Ubuntu 20.04, Windows 10
      • Monitor(s):
      • LG 34GN850
      • Internet:
      • FIOS
    telnet is horrendously insecure - how about running some kind of daemon on the servers for monitoring purposes, which can then report back, in a more friendly manner? you could write the daemon in c#, using either lots of System.Diagnostics.Process or Mono.Unix.Native calls to get the data, then feed it back without ever exposing things like cleartext password info

  7. #7
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,508
    Thanks
    336
    Thanked
    320 times in 255 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre
    It's a good idea hex but more complex than i'm allowed to make it. It's a big company I am working in (near the end of my uni placement) and you know what their rules can be like, in this case I have to use these shell scripts that are on the server. In any case those scripts are crontabbed to run a few times a day and report problems by email. They just want this user friendly way to manually check up on them for the support team.

    I can use ssh but it's just more complex than telnet, and we don't need the security as this is all running on a intranet.
    Last edited by Spud1; 11-05-2006 at 08:36 PM.

  8. #8
    Theoretical Element Spud1's Avatar
    Join Date
    Jul 2003
    Location
    North West
    Posts
    7,508
    Thanks
    336
    Thanked
    320 times in 255 posts
    • Spud1's system
      • Motherboard:
      • Gigabyte Aorus Master
      • CPU:
      • 9900k
      • Memory:
      • 16GB GSkill Trident Z
      • Storage:
      • Lots.
      • Graphics card(s):
      • RTX3090
      • PSU:
      • 750w
      • Case:
      • BeQuiet Dark Base Pro rev.2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Asus PG35VQ
      • Internet:
      • 910/100mb Fibre
    Just an update - I have it working now using the telnet libraries from the link in my first post

    I was having big problems getting the full output of my commands, but it turned out to be a timing issue, and waiting for the next prompt to appear seems to work reliably, given that I know the expected output of the scripts (and any other output means I throw a custom exception)

    thanks for the suggestions though

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Marine Corp's General Reinwald was interviewed
    By XA04 in forum General Discussion
    Replies: 2
    Last Post: 20-08-2005, 11:00 AM
  2. More Redoute codes !
    By Scooby in forum Retail Therapy and Bargains
    Replies: 17
    Last Post: 31-08-2004, 06:14 PM
  3. Who does Free Shipping these days?
    By funnelhead in forum Retail Therapy and Bargains
    Replies: 27
    Last Post: 09-07-2004, 04:19 PM
  4. USA/Canada ONLY: Free VB .NET 2003 Standard Edition
    By Atomic in forum Retail Therapy and Bargains
    Replies: 2
    Last Post: 31-05-2004, 08:14 PM
  5. Free Clothes ! With Vouchers
    By Scooby in forum Retail Therapy and Bargains
    Replies: 132
    Last Post: 16-01-2004, 11:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •