Need help understanding some codes

what does while(!Serial.available()) SPARK_WLAN_Loop(); means

TCPServer server = TCPServer(23);
TCPClient client;

void setup()
{
  // start listening for clients
  server.begin();

  // Make sure your Serial Terminal app is closed before powering your Core
  Serial.begin(9600);
  // Now open your Serial Terminal, and hit any key to continue!
  while(!Serial.available()) SPARK_WLAN_Loop();

  Serial.println(WiFi.localIP());
  Serial.println(WiFi.subnetMask());
  Serial.println(WiFi.gatewayIP());
  Serial.println(WiFi.SSID());
}

void loop()
{
  if (client.connected()) {
    // echo all available bytes back to the client
    while (client.available()) {
      server.write(client.read());
    }
  } else {
    // if no client is yet connected, check for a new connection
    client = server.available();
  }
}

this is from the doc
i wanted to be able to connect using TCP without serial but this has to connect to serial first
i been unable to connect to tcp without using serial first

Your first question:

What does while(!Serial.abailable()) SPARK_WLAN_Loop(); mean

This basically loops until there is an available serial connection. While waiting for a connection it calls SPARK_WLAN_Loop(). This seems to be replaced by Spark.process found here. I believe @peekay123 discussed this at one point.

You should be able to utilize a TCPServer without having a serial connection. The code below should work. DISCLAIMER! Untested… Don’t judge if it doesn’t work.

TCPServer server = TCPServer(23);
TCPClient client;

void setup()
{
// start listening for clients
server.begin();
}

void loop()
{
    if (client.connected()) {
        // echo all available bytes back to the client
        while (client.available()) {
            server.write(client.read());
        }
    } else {
        // if no client is yet connected, check for a new connection
        client = server.available();
    }
}

Good luck with your project!

Brent

thx