求大神指点 UDP的 GetData 放在线程里面就收不到信息 要怎么处理呀
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.ClickDim xc = New Threading.Thread(AddressOf aa)
xc.Start()
这里放在线程运行的话就收不到信息
直接调用的话就能收到信息
' aa()
End Sub
Sub aa()
Dim sockf = CreateObject("MSWinsock.Winsock")
sockf.Protocol = "1"
sockf.Bind("8888")
Dim da = ""
Do
sockf.GetData(da, vbString)
If da <> "" Then
MsgBox(da)
Exit Do
End If
Loop
End Sub