Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By martinayotte
#39963 Maybe you should share your code to see if we can pin-point the error.
Also, have a look at ESP8266WiFi/examples/WiFiTelnetToSerial example, but instead of outputting to serial accumulate the characters received into a buffer until new line and then execute your command parsing on that buffer.
User avatar
By Joy Acharya
#60459 please check this code...
Code: Select all#include <ESP8266WiFi.h>

// wifi connection variables
const char* ssid = "xxxxxxxx";
const char* password = "xxxxxx";
WiFiServer server(2000);


void setup()
{
  Serial.begin(115200);
  Serial.println();

  Serial.printf("Connecting to %s ", ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println(" connected");

  server.begin();
  Serial.printf("TCP server started, open %s in your com operator\n", WiFi.localIP().toString().c_str());
}

void loop()
{
 WiFiClient client = server.available();
 
  if (client) {
   
    Serial.println("Client connected.");
   
    while (client.connected())
    { 
     
      if (client.available())
      {
         //String line = client.readStringUntil('\r');
         // Read incoming message
         char inChar = client.read();
         // Send back something to the clinet
         server.write(inChar);
         // Echo input on Serial monitor
         Serial.write(inChar);       
      }
    }
   
    Serial.println("Client disconnected.");
    client.stop();
  }
}
User avatar
By Shivank
#67123 Hi spy king,
Great post!
I want a simple ESP8266 - Laptop connection over wifi. I am using arduino ide to program my esp. Please guide me from where should I start. Suggest link, video or tutorial.

Regards,
Shivank
User avatar
By Manowar
#71772 Got a problem with connection to server, putty prints unexpected end of connection.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>

// Hardcode WiFi parameters as this isn't going to be moving around.
const char* ssid = "ESP";
const char* password = "";

// Start a TCP Server on port 5045
WiFiServer server(5045);
WiFiClient client;
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_AP);
WiFi.softAP(ssid,password);

// Start the TCP server
server.begin();
}

void loop() {
TCPServer();
}

void TCPServer () {
client = server.available();
if (client) {
if (client.connected()) {
Serial.println("Connected to client");
}
if (client.available() > 0) {

// Send back something to the clinet
server.write(1);
// Echo input on Serial monitor
Serial.write(1);
}
}
}

sometimes got in log chg_A2:-40 but not always. Need some help, don't mind what's a problem.