Files
BR_YKC/4G/tools/_temp/script/temp_script/socket.lua

122 lines
1.1 KiB
Lua
Raw Normal View History

2026-04-03 12:14:43 +08:00
require "socket4G"
module(..., package.seeall)
socket.isReady = link.isReady
local tSocketModule = nil
local function init()
tSocketModule = tSocketModule or {
[link.CELLULAR] = socket4G,
[link.CH395] = socketCh395,
[link.W5500] = socketW5500,
[link.ESP8266] = socketESP8266
}
end
function tcp(ssl, cert, tCoreExtPara, ipv6)
init()
return tSocketModule[link.getNetwork()].tcp(ssl, cert, tCoreExtPara, ipv6)
end
function udp(ipv6)
init()
return tSocketModule[link.getNetwork()].udp(ipv6)
end
function setTcpResendPara(retryCnt, retryMaxTimeout)
init()
return tSocketModule[link.getNetwork()].setTcpResendPara(retryCnt, retryMaxTimeout)
end
function setDnsParsePara(retryCnt, retryTimeoutMulti)
init()
return tSocketModule[link.getNetwork()].setDnsParsePara(retryCnt, retryTimeoutMulti)
end
function printStatus()
init()
return tSocketModule[link.getNetwork()].printStatus()
end
function setLowPower(tm)
init()
return tSocketModule[link.getNetwork()].setLowPower(tm)
end
function setIpStatis(interval)
init()
return tSocketModule[link.getNetwork()].setIpStatis(interval or 0)
end