用TCP发送消息.就必须先于对方建立连接,对方必须先同意,才能发送消息
在窗体模块的最上面加上API声明
Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
在第一次senddate之前加上:
Dim i As Long
Do Until Winsock1.State = 7 Or i > 600
i = i + 1
DoEvents
Sleep
Loop
If i >= 600 Or Winsock1.State = 7 Then
' 1分钟后,对方仍然未同意,连接超时.
End If
再进行senddate