|
|
@@ -174,7 +174,7 @@ local function taskClient(cbFnc, reqAddr, timeout, productKey, host, port,reqTim
|
|
|
local rx_buff = zbuff.create(17)
|
|
|
-- sys.wait(5000)
|
|
|
while true do
|
|
|
- local result
|
|
|
+ local result,succ,param
|
|
|
local netc = socket.create(nil, d1Name) -- 创建socket对象
|
|
|
if not netc then cbFnc(6) return end -- 创建socket失败
|
|
|
socket.debug(netc, false)
|
|
|
@@ -187,14 +187,12 @@ local function taskClient(cbFnc, reqAddr, timeout, productKey, host, port,reqTim
|
|
|
sys.wait(2000);
|
|
|
result, _ = libnet.tx(d1Name, 0, netc, reqStr) ---发送数据
|
|
|
if result then
|
|
|
- local succ, param
|
|
|
- for i=1,10 do
|
|
|
- succ, param, _, _ = socket.rx(netc, rx_buff) -- 接收数据
|
|
|
- sys.wait(1000);
|
|
|
- if param ~= 0 then
|
|
|
- break
|
|
|
- end
|
|
|
+ result, param = libnet.wait(d1Name, 10000, netc)
|
|
|
+ if not result then
|
|
|
+ log.info("服务器断开了", result, param)
|
|
|
+ break
|
|
|
end
|
|
|
+ succ, param, _, _ = socket.rx(netc, rx_buff) -- 接收数据
|
|
|
log.info("是否接收和数据长度", succ, param)
|
|
|
if param ~= 0 then -- 如果接收成功
|
|
|
socket.close(netc) -- 关闭连接
|