473,396 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how do i telnet to an ip address from vb.net code

Hi guys im trying to telnet to an IP address that is entered into a textbox from the click of a button but im having problems as it just gives me errors when i run it. Here is my code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnTelnet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTelnet.Click
  2.  Dim telnet As Process = New Process
  3.         telnet.StartInfo.FileName = "telnet.exe"
  4.         telnet.StartInfo.Arguments = "o" + txthostname.text
  5.         telnet.StartInfo.WindowStyle = ProcessWindowStyle.Normal
  6.         telnet.StartInfo.CreateNoWindow = True
  7.         telnet.Start()
  8.     End Sub 
  9.  
without the "telnet.StartInfo.Arguments = "o" + txthostname.text" command it just opens telnet but with the code it says "unexpected error continue or quit".

Any help would be great
Cheers
Mar 17 '08 #1
8 5890
Plater
7,872 Expert 4TB
Well uh, what are you trying to do?
I don't see you capturing the input/output/error streams, but you tell it to NOT create a window.
Mar 18 '08 #2
Well uh, what are you trying to do?
I don't see you capturing the input/output/error streams, but you tell it to NOT create a window.
Hi mate, thanks for the reply.

What im trying to do is enter an ethernet ip address into a textbox then click the "telnet button" which opens up microsoft telent command prompt and automatically enters in the IP address that was entered in to the text box and telnets to the interface...this is so basically the user doesnt need to enter a IP address when telnet opens.

Does anyone know how to do this in code?
Thanks in advance
Mar 18 '08 #3
Plater
7,872 Expert 4TB
Well if that is the case, be sure to remove this line:
telnet.StartInfo.CreateNoWindow = True

so a window will popup for the user to see.
Mar 18 '08 #4
Well if that is the case, be sure to remove this line:
telnet.StartInfo.CreateNoWindow = True

so a window will popup for the user to see.
Thanks for the advice but still doesnt work. Is there anyway to send arguments to the telnet session once opened?

Cheers
Mar 18 '08 #5
Plater
7,872 Expert 4TB
I just noticed that you are adding that "o" in there, whereas telnet does not take such arguments.
Try
Expand|Select|Wrap|Line Numbers
  1. telnet.StartInfo.FileName = "telnet.exe"
  2. telnet.StartInfo.Arguments = txthostname.text
  3.  
Mar 18 '08 #6
I just noticed that you are adding that "o" in there, whereas telnet does not take such arguments.
Try
Expand|Select|Wrap|Line Numbers
  1. telnet.StartInfo.FileName = "telnet.exe"
  2. telnet.StartInfo.Arguments = txthostname.text
  3.  
Tried this and it opens Telnet but doesnt enter the txthostname.txt argument for me :(

thought the "o" stood for open that why i did that.
Cheers again
Mar 18 '08 #7
Plater
7,872 Expert 4TB
When I run "telnet.exe (some ip address)" it opens and connects for me.
Mar 18 '08 #8
Sorry mate its my fault was entering an IP address in the wrong text box lmao..DOH!

Works a treat thank you very much
Mar 18 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: G520 | last post by:
Hi I have been getting statistical rapports from a machine via a telnet server. Until now it has been done manually. However I want to automate the proccess, and scedule a PHP script to run...
4
by: Donnal Walter | last post by:
On Windows XP I am able to connect to a remote telnet server from the command prompt using: telnet nnn.nnn.nnn.nnn 23 where nnn.nnn.nnn.nnn is the IP address of the host. But using telnetlib,...
0
by: CJ | last post by:
Can someone look at the code below and tell me whats going on? Here is the problem. I can successfully telnet one of our routers and successfully put in a command in the while statement, but...
7
by: Rex Winn | last post by:
I've Googled until my eyes hurt looking for a way to issue Telnet commands from C# and cannot find anything but $300 libraries that encapsulate it for you. I don't want to be able to create a...
2
by: _andrea.l | last post by:
I'm writing a little script for reading information from a router by telnet. I have a problem How give a comand and get the answer more times? I means: $usenet = fsockopen($cfgServer,...
0
by: goroth | last post by:
I am trying to create a telnet client that will connect to several of my network devices on campus and change settings on the devices. So far I can connect with the code below, but I can't seem to...
14
by: piercy | last post by:
I've already got some code in place which allows me to connect to a smtp server and verify the ip(just checks for a timeout.). anyway, i now need the app to check that the user and password its given...
2
by: thamayanthi | last post by:
Hi, The below code is used to connect to the remote machine using Telnet module in perl. use Net::Telnet; use Net::Ping; $telnet = new Net::Telnet (Timeout=>10,Errmode=>'die'); open...
0
by: Graycon | last post by:
I am trying to reboot several devices on my private network through telnet. I wrote a vbs that does the operation but i cannot select any other window while it is running of the input will not go...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.