tries=0
ssid="xxxxxx"
pswd="xxxxxx"
--start by setting both station and AP modes
wifi.setmode(wifi.STATIONAP)
wifi.ap.config({ssid="ESP",pwd = "12345678"})
tmr.alarm(0, 100, 1, function(Q)
if wifi.ap.getip() == nil then
tries=tries+1 --wait for AP to come up
else
tmr.stop(0)
print("after "..tries.." AP IP=",wifi.ap.getip())
--now connect to LAN
wifi.sta.config(ssid,pswd)
wifi.sta.connect()
tries=0
tmr.alarm(0, 100, 1, function(Q)
if wifi.sta.getip() == nil then
tries=tries+1 --wait for LAN to come up
else
tmr.stop(0)
print("after "..tries.." STA IP=",wifi.sta.getip())
dofile("server.lua") --start serving like...
-- srv=net.createServer(net.TCP)
-- srv:listen(80,function(conn)
end
end)
end
end)I get the following:
after 0 AP IP= 192.168.1.1 255.255.255.0 192.168.1.1
after 31 STA IP= 192.168.1.173 255.255.255.0 192.168.1.254
While I can connect to ESP AP, and get pages from the server at 192.168.1.1, I can't connect to the server via the LAN on 192.168.1.173
Am I right in thinking this would require another net.createServer(net.TCP) and there can only be one TCP connection?
If so, what might be the use of STATIONAP mode?