用api GetCountTick
dim blnRet as boolean
---------------------------
Winsock_DataArrival()
'你的代码
blnRet=ture '有数据到达
end sub
-------------------------
'send data 模块
dim a as long
dim b as long '延时的时间
b=30000 '延时30秒
winsock.senddata "aaa"
blnret=false
a=getcounttick
do
doevents '一定要加
if blnret=ture then exit do
if a<getcounttick-b then
msgbox "超时"
winsock.close
exit do
end if
loop