user40214: I need help: my Arduino is not receiving or reading from an ESP8266-01 as a client.
Actually, the ESP01-server and ESP01-client are successfully talking each other but if I attach the Arduino Uno to read the data from the server, nothing happens. It's not receiving at all.
Any help is very much appreciated.


Lua server:
-- GMKSoft
--*************************
--    ESP8266 Server
--*************************

--*************************
--  Static Configuration
--*************************
cfg =
{
    ip="192.168.255.101",
    netmask="255.255.255.0",
    gateway="192.168.0.1"
}
wifi.ap.setip(cfg)

wifi.setmode(wifi.STATIONAP);
wifi.ap.config({ssid="GMKSoft",pwd="GMKSoftESP"});
print("Server IP Address:",wifi.ap.getip())

sv = net.createServer(net.TCP) 
sv:listen(8080, function(conn)
    conn:on("receive", function(conn, receivedData) 
        print("Received Data: " .. receivedData)         
    end) 
    conn:on("sent", function(conn) 
      collectgarbage()
    end)
end)

Client lua:
-- GMKSoft
--*************************
--    ESP8266 Client
--*************************

--*************************
--  Static Configuration
--*************************
client_ip="192.168.255.102"
client_netmask="255.255.255.0"
client_gateway="192.168.0.1"

wifi.setmode(wifi.STATION)
wifi.setphymode(wifi.PHYMODE_N) 
wifi.sta.config("GMKSoft","GMKSoftESP") -- connecting to server
wifi.sta.connect()
if client_ip ~= "" then
    wifi.sta.setip({ip=client_ip,netmask=client_netmask,gateway=client_gateway})
end 

tmr.alarm(1, 2000, 1, function()

     if(wifi.sta.getip()~=nil) then
          tmr.stop(1)
          print("Connected!")
          print("Client IP Address:",wifi.sta.getip())
          cl=net.createConnection(net.TCP, 0)
          cl:connect(8080,"192.168.255.101")

          tmr.alarm(2, 5000, 1, function() 
            cl:send("Hello World!")                  
          end)

         tmr.stop(2)
         print("Going to sleep")
         wifi.sta.sleeptype(wifi.MODEM_SLEEP)
      else
         print("Connecting...")
      end
end)

Arduino Code:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  // set the data rate for the SoftwareSerial port
  mySerial.begin(115200);
}

void loop() {
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}


user40214: I successfully communicate with two esp01 module as a AP and STATION.
The esp01 as a server, please flash it using NodeMCU-PyFlasher-2.1, and used this bin file nodemcu-master-7-modules-2017-11-23-15-58-17-integer.bin 
I build it from  here
Here is the code of the server, I'm using ESPPlorer IDE lua script:
cfg={}
cfg.ssid="GMKWiFi"
cfg.pwd="GMKSoft2627"

dhcp_config ={}
dhcp_config.start = "192.168.1.100"
wifi.ap.dhcp.config(dhcp_config)

print("ESP8266 Server")
wifi.setmode(wifi.STATIONAP);
wifi.ap.config(cfg);
print("Server IP Address:",wifi.ap.getip())

sv = net.createServer(net.TCP) 
sv:listen(80, function(conn)
    conn:on("receive", function(conn, receivedData) 
        print(receivedData)         
    end) 
    conn:on("sent", function(conn) 
      collectgarbage()
    end)
end)

Here is the Client Code, Im using Arduino IDE
#include <ESP8266WiFi.h>
const char* ssid     = "yourSSID";         // SSID
const char* password = "yourpassword";     // Password
const char* host = "192.168.4.1";         // Server IP
const int   port = 80;                    // Server Port
const int   watchdog = 5000;              // Watchdog frequency
unsigned long previousMillis = millis(); 

void setup() {
  Serial.begin(115200);
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  unsigned long currentMillis = millis();

  if ( currentMillis - previousMillis > watchdog ) {
    previousMillis = currentMillis;
    WiFiClient client;

    if (!client.connect(host, port)) {
      Serial.println("connection failed");
      return;
    }

    String url;
    url += "R1";

    client.print(url);
  }
}


40214: <p>I need help: my Arduino is not receiving or reading from an ESP8266-01 as a client.</p>

<p>Actually, the ESP01-server and ESP01-client are successfully talking each other but if I attach the Arduino Uno to read the data from the server, nothing happens. It's not receiving at all.</p>

<p>Any help is very much appreciated.</p>

<p><a href="https://i.stack.imgur.com/OvCWt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OvCWt.png" alt="NodeMCUPyFlasher"></a>
<a href="https://i.stack.imgur.com/pOCAE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pOCAE.png" alt="im using ESplorer IDE"></a>
Lua server:</p>

<pre><code>-- GMKSoft
--*************************
--    ESP8266 Server
--*************************

--*************************
--  Static Configuration
--*************************
cfg =
{
    ip="192.168.255.101",
    netmask="255.255.255.0",
    gateway="192.168.0.1"
}
wifi.ap.setip(cfg)

wifi.setmode(wifi.STATIONAP);
wifi.ap.config({ssid="GMKSoft",pwd="GMKSoftESP"});
print("Server IP Address:",wifi.ap.getip())

sv = net.createServer(net.TCP) 
sv:listen(8080, function(conn)
    conn:on("receive", function(conn, receivedData) 
        print("Received Data: " .. receivedData)         
    end) 
    conn:on("sent", function(conn) 
      collectgarbage()
    end)
end)
</code></pre>

<p>Client lua:</p>

<pre><code>-- GMKSoft
--*************************
--    ESP8266 Client
--*************************

--*************************
--  Static Configuration
--*************************
client_ip="192.168.255.102"
client_netmask="255.255.255.0"
client_gateway="192.168.0.1"

wifi.setmode(wifi.STATION)
wifi.setphymode(wifi.PHYMODE_N) 
wifi.sta.config("GMKSoft","GMKSoftESP") -- connecting to server
wifi.sta.connect()
if client_ip ~= "" then
    wifi.sta.setip({ip=client_ip,netmask=client_netmask,gateway=client_gateway})
end 

tmr.alarm(1, 2000, 1, function()

     if(wifi.sta.getip()~=nil) then
          tmr.stop(1)
          print("Connected!")
          print("Client IP Address:",wifi.sta.getip())
          cl=net.createConnection(net.TCP, 0)
          cl:connect(8080,"192.168.255.101")

          tmr.alarm(2, 5000, 1, function() 
            cl:send("Hello World!")                  
          end)

         tmr.stop(2)
         print("Going to sleep")
         wifi.sta.sleeptype(wifi.MODEM_SLEEP)
      else
         print("Connecting...")
      end
end)
</code></pre>

<p>Arduino Code:</p>

<pre><code>#include &lt;SoftwareSerial.h&gt;

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  // set the data rate for the SoftwareSerial port
  mySerial.begin(115200);
}

void loop() {
  if (mySerial.available()) {
    Serial.write(mySerial.read());
  }
  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
}
</code></pre>
 40214: <p>I successfully communicate with two esp01 module as a AP and STATION.</p>

<p>The esp01 as a server, please flash it using NodeMCU-PyFlasher-2.1, and used this bin file nodemcu-master-7-modules-2017-11-23-15-58-17-integer.bin </p>

<p>I build it from  <a href="https://nodemcu-build.com/" rel="nofollow noreferrer">here</a></p>

<p>Here is the code of the server, I'm using ESPPlorer IDE lua script:</p>

<pre><code>cfg={}
cfg.ssid="GMKWiFi"
cfg.pwd="GMKSoft2627"

dhcp_config ={}
dhcp_config.start = "192.168.1.100"
wifi.ap.dhcp.config(dhcp_config)

print("ESP8266 Server")
wifi.setmode(wifi.STATIONAP);
wifi.ap.config(cfg);
print("Server IP Address:",wifi.ap.getip())

sv = net.createServer(net.TCP) 
sv:listen(80, function(conn)
    conn:on("receive", function(conn, receivedData) 
        print(receivedData)         
    end) 
    conn:on("sent", function(conn) 
      collectgarbage()
    end)
end)
</code></pre>

<p>Here is the Client Code, Im using Arduino IDE</p>

<pre><code>#include &lt;ESP8266WiFi.h&gt;
const char* ssid     = "yourSSID";         // SSID
const char* password = "yourpassword";     // Password
const char* host = "192.168.4.1";         // Server IP
const int   port = 80;                    // Server Port
const int   watchdog = 5000;              // Watchdog frequency
unsigned long previousMillis = millis(); 

void setup() {
  Serial.begin(115200);
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");  
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  unsigned long currentMillis = millis();

  if ( currentMillis - previousMillis &gt; watchdog ) {
    previousMillis = currentMillis;
    WiFiClient client;

    if (!client.connect(host, port)) {
      Serial.println("connection failed");
      return;
    }

    String url;
    url += "R1";

    client.print(url);
  }
}
</code></pre>
