I'm building a small LXI device using a the OLIMEX ESP32 POE Board. Sending commands to the device using pyVisa works fine, but queries don't. Only the IDN? query works. From the ESP I get the following message over the serial port:

[E][WiFiClient.cpp:392] write(): fail on fd 58, errno: 104, "Connection reset by peer"

and the query returns none...

Server code looks like this:

void serveLxi(WiFiClient client) {
  String header = "";
  Serial.println("New Client.");          // print a message out in the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then

        header += c;
        if (c == '\n') {  
            String response = command.checkCommand(header);

            header = "";  


void loop() {
  WiFiClient client = lxiServer.available();
  if (client)
    Serial.println("new connection");

It seems like the connection fails before the client receives the response. Is there a error in my server?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.