vb.net连接到telnet获取问号

时间:2013-11-29 14:50:28

标签: vb.net connect decode telnet username

我正在尝试使用以下代码连接到telnet:

 Dim ClientSocket As New TcpClient
    Dim ServerStream As NetworkStream
    Dim ServerAddress As String = "111.222.333.444" 
    Dim PortNumber As Integer = 23    
    Dim OutStream As Byte() = Encoding.ASCII.GetBytes("what command should be here?")
    Dim ReceivedData As String
ClientSocket.Connect(ServerAddress, PortNumber)
        Dim inStream(100000) As Byte
        ServerStream = ClientSocket.GetStream()
        ServerStream.Write(OutStream, 0, OutStream.Length)
        ServerStream.Flush()
        ServerStream.Read(inStream, 0, CInt(ClientSocket.ReceiveBufferSize))
        ReceivedData = Encoding.ASCII.GetString(inStream)
msgbox (ReceivedData )

但是我得到???? | ??#??'这是什么?我该如何解码呢?在运行命令之前,我需要传递一个用户名和密码来telnet。我怎么做?我不熟悉这种东西。

0 个答案:

没有答案