调用telnet 问题
我要在asp调用telnet,要怎么做啊,还有就是我如何把ip也传递过去啊?各位指点下 问题点数:50、回复次数:7Top
1 楼liuxiaoyi666(MSMVP 小猪妹荣誉马甲之八卦兔子)回复于 2005-04-02 19:31:05 得分 10
wscript.shell 调用telnet吧
如果还希望复杂可以用组件的,我见过vb写的telnet的开发的东西Top
2 楼forwardchen(努力向明天)回复于 2005-04-02 19:39:14 得分 0
能不能给我些源程序看啊??我老是实现不了Top
3 楼liuxiaoyi666(MSMVP 小猪妹荣誉马甲之八卦兔子)回复于 2005-04-02 19:46:18 得分 20
'清理控制台
Private Sub ClCons_Click()
Text1.Text = ""
'如果已经连接就不清空Text2(输入框的内容)
If Winsock1.State = 7 Then Exit Sub
Text2.Text = ""
End Sub
'关闭连接
Private Sub CloseCon_Click()
Winsock1.Close
End Sub
'外部连接
Private Sub ExtCon_Click()
Form2.Show 1
End Sub
Private Sub Form_Load()
'获取设置
a = GetSetting("Telnetclient", "Last", "Server", "")
'line3是Connection菜单中的空行
'用于显示上次的连接
If a = "" Then
line3.Visible = False
LastConnection.Visible = False
Else
LastConnection.Caption = "1. " & a
End If
End Sub
Private Sub Form_Resize()
'保证Text1和Text2的大小与Form一致
Text1.Width = Form1.Width - 375
Text2.Width = Form1.Width - 375
Text1.Height = Form1.Height - 1275
Text2.Top = Form1.Height - 1050
End Sub
'连接上次的连接
Private Sub LastConnection_Click()
On Error GoTo 1
'获取上次的连接
a = GetSetting("Telnetclient", "Last", "Server", "")
b = GetSetting("Telnetclient", "Last", "Port", 23)
Winsock1.Close
'连接
Winsock1.Connect a, b
Timer1.Enabled = True
Exit Sub
1 Winsock1.Close
MsgBox Err.Description, vbCritical
End Sub
'关闭程序
Private Sub Quit_Click()
Unload Me
End Sub
'控制Text1的输出
Private Sub Text1_Change()
Text1.SelStart = Len(Text1.Text)
Text2.SetFocus
End Sub
'控制Text2的输出
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
KeyCode = 0
End Sub
'发送Text2的字符
Private Sub Text2_KeyPress(KeyAscii As Integer)
On Error GoTo 1
If KeyAscii = 13 Then
Text2.Text = ""
Winsock1.SendData Chr(13)
KeyAscii = 0
Else
Winsock1.SendData Chr(KeyAscii)
End If
Exit Sub
1 KeyAscii = 0
End Sub
'连接超时到,断开连接
Private Sub Timer1_Timer()
Timer1.Enabled = False
Winsock1.Close
MsgBox "Unable to connect", vbCritical
End Sub
'连接被断开
Private Sub Winsock1_Close()
Timer1.Enabled = False
MsgBox "Connection with host lost"
Me.Caption = "Telnet Client Emu"
Winsock1.Close
End Sub
'连接成功
Private Sub Winsock1_Connect()
Me.Caption = "Telnet Client Emu [" & Winsock1.RemoteHostIP & ":" & Winsock1.RemotePort & "]"
Timer1.Enabled = False
End SubTop
4 楼forwardchen(努力向明天)回复于 2005-04-02 20:14:06 得分 0
赫赫,谢谢啊,不过我想知道的是wscript.shell怎么调用Top
5 楼forwardchen(努力向明天)回复于 2005-04-02 21:10:04 得分 0
有谁答我吗??Top
6 楼forwardchen(努力向明天)回复于 2005-04-03 11:07:31 得分 0
有没人解答啊??
Top
7 楼liuxiaoyi666(MSMVP 小猪妹荣誉马甲之八卦兔子)回复于 2005-04-03 11:47:38 得分 20
wscript.shell 关键是我对dos命令不是很熟悉了,参数都不记得了,需要查的,太麻烦了,懒得写了
你只要会用wscript.shell这个应该是很容易的Top




