Simple Telnet Client
Simple Telnet Client
Simple Telnet Client
Simple Telnet Client
Simple Telnet Client
Simple Telnet Client Simple Telnet Client Simple Telnet Client Simple Telnet Client Simple Telnet Client Simple Telnet Client Simple Telnet Client Simple Telnet Client
Simple Telnet Client Simple Telnet Client
Simple Telnet Client
Go Back  Xtreme Visual Basic Talk > > > Simple Telnet Client


Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2006, 09:07 PM
joshjoneswas joshjoneswas is offline
Regular
 
Join Date: Feb 2004
Posts: 65
Thumbs up Simple Telnet Client


This is astonishing to me. I have scoured the net and not found any simple tutorials on using telnet in vb 2005!

I just realized tonight that I cannot create a batch file to telnet to a host in DOS then run a few commands after the login. (sort of a no duh moment since dos RUNS telnet..and then waits for it to get done so you can't script inside of that!)

I found a pretty neat telnet scripting tool by Albert Yale, but I'd rather do it behind the scenes since this will be a tool that we use at work where others will see it in action. Not too professional really with that third party implementation.

I just need it to connect to a telnet client, send the user name and password, then run a cmd file on that machine.

In VB6 I would always use a winsock control to do this. How is it done in vb 2005? I keep seeing sockets and other terms used while scouring.

Anyone help a fellow out? Thanks!
Reply With Quote
  #2  
Old 08-29-2006, 09:51 PM
wayneph's Avatar
waynephSimple Telnet Client wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

Here is something I found the other day. Note, that I've never used it, but it claims to work...
http://www.xtremevbtalk.com/-net-communications/269233-vb-unix-post1174455.html
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #3  
Old 08-29-2006, 10:17 PM
joshjoneswas joshjoneswas is offline
Regular
 
Join Date: Feb 2004
Posts: 65
Default

Thank you. That almost got it.

I'm pretty good with C#, but didn't quite get all that the code was trying to do after VS2005 upgraded the example code. In fact, it didn't compile. But I tried to get the jist of it and it looks as though it is referencing system.net.sockets... so I will continue to mess around with that end of it...

I took off on the web again to see if I could find any telnet examples in C# and came up with no real quality results...shocking to me, truly.

Usually when I am browsing the net for something like this and it does not show up readily available, I find that I am approaching the problem at the wrong angle. But this one is different. I really don't understand why someone SOMEWHERE has not connected via telnet with anything in VS2005!

Any other suggestions Wayne?
Reply With Quote
  #4  
Old 08-30-2006, 07:51 AM
dannyb dannyb is offline
Junior Contributor
 
Join Date: Jul 2006
Location: Gatineau, Quebec
Posts: 273
Default

You could look at the MSDN forum wich talks about what your looking to do.
http://forums.microsoft.com/MSDN/Sho...40202&SiteID=1
__________________
One must learn from the weak to beat the best
Reply With Quote
  #5  
Old 08-30-2006, 09:12 AM
wayneph's Avatar
waynephSimple Telnet Client wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

Quote:
Originally Posted by dannyb
You could look at the MSDN forum wich talks about what your looking to do.
http://forums.microsoft.com/MSDN/Sho...40202&SiteID=1
That points to the same link in my previous post.

Quote:
Originally Posted by joshjoneswas
I really don't understand why someone SOMEWHERE has not connected via telnet with anything in VS2005!
I'm sure someone has. It just looks like that they haven't posted anywhere with how they did it...

In the MS 101 Samples it looks like group 2 has a sockets example, but I haven't looked at it to see what it actually does...
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #6  
Old 08-30-2006, 05:43 PM
joshjoneswas joshjoneswas is offline
Regular
 
Join Date: Feb 2004
Posts: 65
Default

I am looking into that one. It will take some dumbing down of the MSDN code I'll bet, but I'll hopefully figure it out.

Anyone heard of a C# example doing this over the last few years?
Reply With Quote
  #7  
Old 09-09-2006, 05:52 PM
dilettante's Avatar
dilettanteSimple Telnet Client dilettante is online now
Underclocked lifestyle

Forum Leader
* Guru *
 
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,529
Default

As a total .Net newbie I've recently been tearing my hair out once again trying to wrap my head around the way socket I/O is done. I've been amazed at the small number and poor quality of examples and descriptive text on the subject. That includes those from Microsoft.

Ignorant diatribe aside though, have you considered another solution? Say, something that doesn't require hacking together a program in VB.Net or C#?


For this very kind of thing I've found a handy free ActiveX component from Dimac to be just the ticket. I've used it for lots of little administrative tasks, from pinging HTTP servers to performing remote functions via Telnet just as you've described.

As I said, it's free - though they will make you register to get the download: Dimac Free Downloads. Once you have this installed you can handily script your way to a solution. Here's an example:

FetchDir.vbs
Code:
Set w3sock = CreateObject("socket.tcp") With w3sock .DoTelnetEmulation = True .TelnetEmulation = "TTY" .Host = "localhost:23" .Open .WaitFor "login:" .SendLine "YOURUSERID" .WaitFor "password:" .SendLine "YOURPASSWORD" .WaitFor ">" .SendLine "prompt $LREADY$G" .WaitFor "<READY>" .SendLine "dir c:\windows\repair" .WaitFor "<READY>" 'Parse echoed DIR line and trailing <READY> off results. WScript.Echo Split(Split(.Buffer, vbNewLine, 2)(1), "<READY>")(0) .Close End With Set w3sock = Nothing
This is just a trivial example, but perhaps close to what you need. Run it from a command line or within a BAT/CMD file as in:

cscript //nologo FetchDir.vbs


My results look like:
Code:
 Volume in drive C is System
 Volume Serial Number is F8B2-FA88

 Directory of c:\windows\repair

07/28/2006  05:39 PM    <DIR>          .
07/28/2006  05:39 PM    <DIR>          ..
08/23/2001  08:00 AM             1,688 autoexec.nt
07/28/2006  05:38 PM             2,577 config.nt
07/28/2006  05:43 PM           237,568 default
07/28/2006  05:43 PM            24,576 sam
07/28/2006  05:39 PM           787,668 secsetup.inf
07/28/2006  05:43 PM            28,672 security
07/28/2006  05:36 PM           208,626 setup.log
07/28/2006  05:43 PM         8,175,616 software
07/28/2006  05:43 PM         1,081,344 system
               9 File(s)     10,548,335 bytes
               2 Dir(s)  12,895,301,632 bytes free

Last edited by dilettante; 09-09-2006 at 05:55 PM. Reason: typo
Reply With Quote
  #8  
Old 09-09-2006, 05:55 PM
joshjoneswas joshjoneswas is offline
Regular
 
Join Date: Feb 2004
Posts: 65
Default

That rocks! I had no idea there was a free one. I found several of them that wanted you to pay.

I am looking into this as we speak. I just wanted to thank you for catching the post and responding back to me!
Reply With Quote
  #9  
Old 03-10-2008, 12:50 PM
DJeep DJeep is offline
Newcomer
 
Join Date: Mar 2008
Posts: 1
Default

Hello,
I am using the vb2005 and DiMac w3sock and have a quick question. My command to show mac-address is stopping at the --More-- statement. How can I pass a space bar to get past the --More-- prompt. Or is there a way I can request the information that will ignore the prompt?
Thank you for your help.
Reply With Quote
  #10  
Old 10-16-2015, 03:17 AM
FleppSch FleppSch is offline
Newcomer
 
Join Date: Oct 2015
Posts: 2
Default

Hi,

I know this post has not been edited for more than 7 years but right now I'm stucked with the same problem as DJeep. My telnet session sometimes comes up with a "--More--" line and is waiting for a keypress. How can I solve/work around it ?

Thx
Regards
Philippe
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Simple Telnet Client
Simple Telnet Client
Simple Telnet Client Simple Telnet Client
Simple Telnet Client
Simple Telnet Client
Simple Telnet Client Simple Telnet Client Simple Telnet Client Simple Telnet Client Simple Telnet Client Simple Telnet Client Simple Telnet Client
Simple Telnet Client
Simple Telnet Client
 
Simple Telnet Client
Simple Telnet Client
 
-->