方法:
工程-添加部件-找到microsoft internet transfer control 6.0
private sub form_load()
inet1.Proxy="192.168.1.100:3128"租培兄
dim temp as string
temp=inet1.openurl("中蚂www.baidu.com")
if instr(temp,"百度")>0 then
'有效
else
'无效
end if
end sub
Winsock属性先设置好。这个你应该知道的。下面冲乎首就按照这个命令试试看。仅供参考~~~~~!
发送命令如下:
Private Sub Command2_Click()
On Error GoTo ErrProc
Dim SendStr(15) As Byte
Dim RcvStr() As Byte
SendStr(0) = XX
SendStr(1) = XX
SendStr(2) = XX
SendStr(3) = XX
SendStr(4) = XX
SendStr(5) = XX
SendStr(6) = XX
SendStr(7) = XX
SendStr(8) = XX
SendStr(9) = XX
SendStr(10) = XX
SendStr(11) = XX
Dim aStr As String
Dim i As Integer
For i = 0 To 11
aStr = aStr &Chr(SendStr(i))
Next
Winsock1.SendData aStr
Exit Sub
ErrProc:
MsgBox "传输数据失败", vbCritical, "网络传输"
Text1.Text = Winsock1.State
End Sub
接收的顷春事件和指令如下:
'数据接收后的处理,仅供显示,若溢出,请disable多余的ax.
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, s As String
Winsock1.GetData s
If bytesTotal >5 Then
a1 = Hex$(Asc(Mid$(s, 1, 1)))
a2 = Hex$(Asc(Mid$(s, 2, 1)))
a3 = Hex$(Asc(Mid$(s, 3, 1)))
a4 = Hex$(Asc(Mid$(s, 4, 1)))
a5 = Hex$(Asc(Mid$(s, 5, 1)))
a6 = Hex$(Asc(Mid$(s, 6, 1)))
a7 = Hex$(Asc(Mid$(s, 7, 1)))
a8 = Hex$(Asc(Mid$(s, 8, 1)))
a9 = Hex$(Asc(Mid$(s, 9, 1)))
a10 = Hex$(Asc(Mid$(s, 10, 1)))
a11 = Hex$(Asc(Mid$(s, 11, 1)))
a12 = Hex$(Asc(Mid$(s, 12, 1)))
a13 = Hex$(Asc(Mid$(s, 13, 1)))
a14 = Hex$(Asc(Mid$(s, 14, 1)))
'a15 = Hex$(Asc(Mid$(s, 15, 1)))
'a16 = Hex$(Asc(Mid$(s, 16, 1)))
'a17 = Hex$(Asc(Mid$(s, 17, 1)))
'a18 = Hex$(Asc(Mid$(s, 18, 1)))
'a19 = Hex$(Asc(Mid$(s, 19, 1)))
'a20 = Hex$(Asc(Mid$(s, 20, 1)))
'a21 = Hex$(Asc(Mid$(s, 21, 1)))
'散数a22 = Hex$(Asc(Mid$(s, 22, 1)))
End If
txtReceive.Text = a1 &"//" &a2 &"//" &a3 &"//" &a4 &"//" &a5 &"//" &a6 &"//" &a7 &"//" &a8 &"//" &a9 &"//" &a10 &"//" &a11 &"//" &a12 &"//" &a13 &"//" &a14 &"//" &a15 &"//" &a16 &"//" &a17 &"//" &a18 &"//" &a19 &"//" &a20 &"//" &a21 &"//" &a22
If Len(txtReceive.Text) >5000 Then
txtReceive.Text = Right(txtReceive.Text, 2000)
End If
Text1.Text = Winsock1.State
End Sub
晕死,你的IP当然还是你的IP,这个只是修或没改IE的上网代理服务器设置而已,和你的本地IP地址衫锋纳根本没有任何关系。请参考:
怎样设置IE浏览器代理服基春务器_百度经验
http://jingyan.baidu.com/article/2fb0ba404f4f4e00f2ec5fd4.html
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)