This isn't working for me when I connect to my solaris box
The server is sending back
??%
does anyone know what i'm doing wrong
Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Public Class TelnetClient
Private _hostname As String = "myserver"
Private _username As String = "user"
Private _password As String = "pass"
Private _port As Integer = 23
Private _client As TcpClient
Private _data As String
Private _sendbuffer(128) As Byte
Private _readbuffer(128) As Byte
Private _bytecount As Integer
Private _stream As NetworkStream
Private Sub Send(ByVal Text As String)
_sendbuffer = Encoding.ASCII.GetBytes(Text)
_stream.Write(_sendbuffer, 0, _sendbuffer.Length)
End Sub
Private Sub Read()
_bytecount = _stream.Read(_readbuffer, 0, _readbuffer.Length)
_data = Encoding.ASCII.GetString(_readbuffer)
End Sub
Public Sub Connect()
_client = New TcpClient(_hostname, _port)
_stream = _client.GetStream
Send(_username)
Read()
MsgBox(_data)
Send(_password)
Read()
_stream.Close()
_client.Close()
End Sub
End Class