A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By tele_player
#68989 This works here, on 8266 and ESP32. I wrote a simple client for it on Raspberry Pi. Obviously, WiFi.begin() and server.begin() must be called in setup().


Code: Select allvoid loop() {
  char buf[128];
  int ix = 0;
  unsigned char foo[4] = {0x0, 0x4, 0x85, 0x34};
 
  if (server.hasClient()) {       // new connection available
    client = server.available();  // accept connection
  } else {   
    delay(100);
    return;
  }

  // send {0x0, 0x4, 0x85, 0x34}; greeting
  client.write(&foo[0], 4);
  Serial.println("sent {0x0, 0x4, 0x85, 0x34}");

  // wait for client to send something
  while (!client.available()) {
    ;
  }
  // read bytes from client
  while(client.available()) {
    buf[ix++] = client.read();
  }
  buf[ix] = 0;

  // print text from client
  Serial.println(buf);
  delay(1000);

}