One Esp8266 Client One Esp8266 Server
<p>I did Server-Client Application with lua using one Esp8266. I wanna do this with two Esp8266. I wanna use one of these Esp8266 is Server and the other other one is Client. You can see below first code using for get RSSI from one AP and second code is using for writing these RSSI in a Server. How can i placed these two codes in two Esp8266?</p>

<pre class="lang-lua prettyprint-override"><code>i=5
tmr.alarm(1,10000,1, function()
print(wifi.sta.getap(scan_cfg, 1, listap))
if i&gt;1 then
print(i)
i=i-1
else
tmr.stop(1)
print("Timer Durdu")
end
end
)
function listap(t)
for bssid,v in pairs(t) do
    local ssid = string.match(v, "([^,]+)")
    l=string.format("%-10s",ssid)
    stringtoarray = {}
    index = 1
         for value in string.gmatch(v,"%w+") do
            stringtoarray [index] = value
            index = index + 1
           end
            print(l)
    print(stringtoarray[2])
           end
end
scan_cfg = {}
scan_cfg.ssid = "VSP250s"
scan_cfg.bssid = "00:09:df:8e:03:b4"
scan_cfg.channel = 0
scan_cfg.show_hidden = 1
</code></pre>

<p>Second code:</p>

<pre class="lang-lua prettyprint-override"><code>srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive", function(client,request)
    local buf = "";
    local _, _, method, path, vars = string.find(request, "([A-Z]+)  (.+)?(.+) HTTP");
    if(method == nil)then
        _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");
    end
    local _GET = {}
    if (vars ~= nil)then
        for k, v in string.gmatch(vars, "(%w+)=(%w+)&amp;*") do
            _GET[k] = v
        end
    end

    buf = buf.."&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;div id='container'&gt;&lt;font size='5'&gt;"
    buf = buf..'&lt;style&gt;body{width:auto;height:auto;background-color:#ffffff;}'
    buf = buf..'.button {font-size: 20px;}&lt;/style&gt;'

    buf = buf.."&lt;head&gt; &lt;meta http-equiv='refresh' content=3&gt; "
    buf = buf.."&lt;p&gt;&lt;h1&gt;RSSI  meter&lt;br&gt; ESP8266&lt;/h1&gt;";

    --buf = buf.."&lt;p&gt;Refresh           : &lt;a href=\"?pin=REFRESH1\"&gt;&lt;button class='button'&gt;ON&lt;/button&gt;&lt;/a&gt;&amp;nbsp&lt;/p&gt;";
    --buf = buf.."&lt;p&gt;Relay Switch      : &lt;a href=\"?pin=ON1\"&gt;&lt;button class='button'&gt;ON&lt;/button&gt;&lt;/a&gt;&amp;emsp;&amp;emsp;"
    --buf = buf.."&lt;a href=\"?pin=OFF1\"&gt;&lt;button class='button'&gt;OFF&lt;/button&gt;&lt;/a&gt;&lt;br&gt;"


    buf = buf..'&lt;B&gt;Voltage   :&lt;font color=red&gt;'..string.format('%s',l)..' V&lt;/font&gt;&lt;/b&gt;&lt;br&gt;'
    buf = buf..'&lt;B&gt;Current           :&lt;B&gt;&lt;font color=blue&gt;'..string.format('%g',stringtoarray[2])..' A&lt;/font&gt;&lt;/b&gt;&lt;br&gt;'
    --buf = buf..'&lt;B&gt;Power Consumption :&lt;B&gt;&lt;font color=DeepSkyBlue&gt;'..'Not Available'..'&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;BR&gt;'
    -- buf = buf..'&lt;p&gt;Function Button   :&lt;B&gt;&lt;font color=BlueViolet&gt;'..button_status..'&lt;/font&gt;&lt;/b&gt;&lt;br&gt;&lt;/p&gt;';

    buf = buf..'&lt;/head&gt;'

    buf = buf..'&lt;br&gt;&lt;br&gt;&lt;details&gt;&lt;summary&gt;&lt;font color=red&gt;BURAK IPEK&lt;/font&gt;&lt;p&gt;'
    buf = buf..'&lt;summary&gt;&lt;p&gt;Vestel Electronics &lt;/p&gt;&lt;/details&gt;'


    buf = buf.."&lt;/body&gt;&lt;/font&gt;&lt;/div&gt;&lt;/html&gt;"

    client:send(buf);
    client:close();
    collectgarbage();
end)
end)
</code></pre>