VB 发送 WPE 封包内容问题
WPE截取到的封包内容为55410000001900B916B25DBC00EF01CD0006799FEB00150001接收者IP为:227.197.XXX.XXX端...
WPE截取到的封包内容为
55 41 00 00 00 19 00 B9 16 B2 5D BC 00 EF 01 CD 00 06 79 9F EB 00 15 00 01
接收者IP为:227.197.XXX.XXX
端口:2318
发送者IP:15.212.XXX.XXX
端口:29999
Winsock1.SendData "55 41 00 00 00 19 00 B9 16 B2 5D BC 00 EF 01 CD 00 06 79 9F EB 00 15 00 01"
这句的包内容需要空格分开不?
下面执行时总是连接超时,那里错了?怎样改?
Private Sub Command1_Click()
Dim rec As String
Winsock1.Close
Winsock1.RemoteHost = "227.197.XXX.XXX"
Winsock1.RemotePort = 2318
Winsock1.LocalPort = 29999
Winsock1.Connect
MsgBox ("connecting")
MsgBox (Winsock1.RemoteHostIP)
t = Timer
Do Until Winsock1.State = 7
DoEvents
If Timer - t >= 3 Then
MsgBox "连接超时"
Exit Sub
End If
Loop
MsgBox "开始发送"
Winsock1.SendData "55 41 00 00 00 19 00 B9 16 B2 5D BC 00 EF 01 CD 00 06 79 9F EB 00 15 00 01"
Winsock1.GetData rec
Text1.Text = rec
End Sub
加分加分~~~~ 展开
55 41 00 00 00 19 00 B9 16 B2 5D BC 00 EF 01 CD 00 06 79 9F EB 00 15 00 01
接收者IP为:227.197.XXX.XXX
端口:2318
发送者IP:15.212.XXX.XXX
端口:29999
Winsock1.SendData "55 41 00 00 00 19 00 B9 16 B2 5D BC 00 EF 01 CD 00 06 79 9F EB 00 15 00 01"
这句的包内容需要空格分开不?
下面执行时总是连接超时,那里错了?怎样改?
Private Sub Command1_Click()
Dim rec As String
Winsock1.Close
Winsock1.RemoteHost = "227.197.XXX.XXX"
Winsock1.RemotePort = 2318
Winsock1.LocalPort = 29999
Winsock1.Connect
MsgBox ("connecting")
MsgBox (Winsock1.RemoteHostIP)
t = Timer
Do Until Winsock1.State = 7
DoEvents
If Timer - t >= 3 Then
MsgBox "连接超时"
Exit Sub
End If
Loop
MsgBox "开始发送"
Winsock1.SendData "55 41 00 00 00 19 00 B9 16 B2 5D BC 00 EF 01 CD 00 06 79 9F EB 00 15 00 01"
Winsock1.GetData rec
Text1.Text = rec
End Sub
加分加分~~~~ 展开
1个回答
展开全部
也许就是根本没有连接上.
有时候Time不准确的,你把时间换成我这种看看,改成这样:
t= Int(CDbl(Now)) + Timer / 86400
Dim NowTime as Double
Do Until Winsock1.State = 7
DoEvents
NowTime =Int(CDbl(Now)) + Timer / 86400
If NowTime - t >= 3 Then
MsgBox "连接超时"
Exit Sub
End If
Loop
有时候Time不准确的,你把时间换成我这种看看,改成这样:
t= Int(CDbl(Now)) + Timer / 86400
Dim NowTime as Double
Do Until Winsock1.State = 7
DoEvents
NowTime =Int(CDbl(Now)) + Timer / 86400
If NowTime - t >= 3 Then
MsgBox "连接超时"
Exit Sub
End If
Loop
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询