473,768 Members | 8,216 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

5 New Member
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.StartIn fo.Arguments = "o" + txthostname.tex t" 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 5929
Plater
7,872 Recognized Expert Expert
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
ivabigun
5 New Member
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...thi s 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 Recognized Expert Expert
Well if that is the case, be sure to remove this line:
telnet.StartInf o.CreateNoWindo w = True

so a window will popup for the user to see.
Mar 18 '08 #4
ivabigun
5 New Member
Well if that is the case, be sure to remove this line:
telnet.StartInf o.CreateNoWindo w = 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 Recognized Expert Expert
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
ivabigun
5 New Member
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 Recognized Expert Expert
When I run "telnet.exe (some ip address)" it opens and connects for me.
Mar 18 '08 #8
ivabigun
5 New Member
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
6205
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 everyday. Using my terminal, I give the command to order a rapport, and then press <ESC>. Then the rapport is printed out.
4
11190
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, this code returns the traceback that follows: import telnetlib host = 'nnn.nnn.nnn.nnn'
0
7273
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 when the loop goes around a second time, it gives me: "pattern match timed-out at c:\filename.pl line 21" It can't get past the waitfor statement for a prompt the 2nd go around in the loop.
7
14099
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 Telnet client. I just need to send a telnet request to a local IP address on a LAN issue a "c" then a "b" and stream back the text for internal use. The "c" changes sub-menus and the "b" is a switch to dump the status of a firewall. I need to issue...
2
2959
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, $cfgPort, &$errno, &$errstr, $cfgTimeOut);
0
3860
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 get the correct return data from the device. Sometimes I get about 100 bytes and other times I get 3000 bytes. I even put a thread sleep but that still give me different return data from different devices. I know I am going to have to use an...
14
9175
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 has access to the smtp to send email. the code i have is as follows. public ScriptingTelnet(string Address, int Port, int CommandTimeout) { address = Address; port = Port; timeout = CommandTimeout; }
2
2995
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 (FILE,"C:/start.txt") or die ("Unable to open start.txt"); while(<FILE>)
0
4848
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 into the telnet window created. I have begun to convert the code to C++ and am having problems I can get telnet to open to the ip address that I want but do not know how to pass any commands to it. I have read about 30 different website and people...
0
9576
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9407
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10175
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9961
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9843
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7384
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5283
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.