求助:vb中使用winsock控件开发telnet客户端程序的问题,详见内
问题:大多数服务器端都可以正常连接,只有一类终端连接后没有任何回显,发送指令也没有反应,而这一类服务器端使用windows命令行的telnet、超级终端、SecureCRT等终端工具都可以正常连接,急盼高人回复。VB代码节选如下:
'送指令
Private Sub SendStringToDevice(LineText As String)
Dim Temp1 As String, L As Integer, i As Integer, K As Integer, A As String
L = Len(LineText)
For i = 1 To L
A = Mid(LineText, i, 1)
Call SendSigleKey(Asc(A))
Next i
End Sub
Private Sub SendSigleKey(KeyAscii As Integer)
On Error GoTo 1
If KeyAscii = 13 Then
'Text2.Text = ""
Winsock1.SendData Chr(13)
KeyAscii = 0
Else
Winsock1.SendData Chr(KeyAscii)
'DoEvents 注释不注释没有区别
End If
Exit Sub
1 KeyAscii = 0
End Sub
'获得和显示数据
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strbuf As String
Winsock1.GetData strbuf, vbString
Text1.Text = Text1.Text & strbuf
End Sub
我已经试了自己能找到的任何方法,但服务器端只返回“????”,服务器是成熟的商用软件,且其他终端工具登录都没有问题。
急啊!