473,383 Members | 1,792 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,383 software developers and data experts.

VB.Net telnet help needed

I need a VB.NET app that allows me to connect to a device using
telnet, send two commands (the second of which terminates the
connection), then confirm that the connection is terminated. If I
telnet normally through Windows, I connect, hit the <ENTERat the
first prompt, wait for the second prompt, then press 9 and then
<ENTERagain. At this point te device reboots and I get disconnected.
The code I've attempted (but failed at) is below. I'm new to this type
of thing, so don't laugh too hard. Thanks in advance for any help.

Imports System.Text

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim telnetclient As New Net.Sockets.TcpClient
Dim ns As System.Net.Sockets.NetworkStream
telnetclient.Connect("xx.xx.xx.xx", 9999)
ns = telnetclient.GetStream
Dim data(1024) As Byte
If ns.CanWrite Then
Dim myWriteBuffer As Byte() =
Encoding.ASCII.GetBytes(vbCrLf)
ns.Write(myWriteBuffer, 0, myWriteBuffer.Length)
myWriteBuffer = Encoding.ASCII.GetBytes("9" & vbCrLf)
ns.Write(myWriteBuffer, 0, myWriteBuffer.Length)
Else
Console.WriteLine("Sorry. You cannot write to this
NetworkStream.")
End If
End Sub
End Class

Apr 10 '07 #1
0 1300

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dan | last post by:
I'm writing a simplistic telnet client in VB6 and I've run into a small snag. The program has a textbox to write in the string to be sent using ..SendData and has another textbox that displays...
3
by: scorpion53061 | last post by:
Does the .NET Framework have a way I can telnet into my unix server and read what I am doing????? I would telnet in to an ip, send a username, then enter then send a password then enter and get me...
2
by: thilandeneth | last post by:
i need to do telnet via a web server please give me a idia to initiate the project following requirements are needed 1 Create web based custom telnet client to communicate with remote...
1
by: laxlou | last post by:
Hi, I'm using script to grab following comma separated data from telnet port. (x86, Windows, ActivePerl) There is coming quite a lot of data from port. several lines per second producing hudreds...
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.