I am having issues with both (TCPserver + Spark access) enabled and use in same code.
Once below code is called in setup(), all the Spark access (functions, variable) will not work.
static TCPServer server=TCPServer(23); // telnet defaults to port 23
I don’t think anyone but the Spark team can access your build web IDE from that link, so if you could pop the code into a github or gist, it would be easier for everybody to see.
After talking to @Dilbert, I tried adding a Spark.variable() to the default webduino sample app, and that behaves strangely too. I can get it to work once, but then sometimes it just continues breathing cyan and the web server is non-responsive and the cloud thinks the core is offline.
I am hoping @mdma or @BDub could take a look at this test case (Sorry-I am busy with other projects right now). There are a number of small but persistent problems where using the cloud features somehow knocks other code over in ways that I don’t understand–maybe this is a good one to debug since it is fairly repeatable.
// This #include statement was automatically added by the Spark IDE.
#include "WebServer/WebServer.h"
/* This creates an instance of the webserver. By specifying a prefix
* of "", all pages will be at the root of the server. */
#define PREFIX ""
WebServer webserver(PREFIX, 80);
int count = 0; //Spark variable counts accesses
/* commands are functions that get called by the webserver framework
* they can read any posted data from client, and they output to the
* server to send data back to the web browser. */
void helloCmd(WebServer &server, WebServer::ConnectionType type, char *, bool)
{
digitalWrite(D7,HIGH);
/* this line sends the standard "we're all OK" headers back to the
browser */
server.httpSuccess();
/* if we're handling a GET or POST, we can output our data here.
For a HEAD request, we just stop after outputting headers. */
if (type != WebServer::HEAD)
{
/* this defines some HTML text in read-only memory aka PROGMEM.
* This is needed to avoid having the string copied to our limited
* amount of RAM. */
P(helloMsg) = "<h1>Hello, World!</h1>";
/* this is a special form of print that outputs from PROGMEM */
server.printP(helloMsg);
server.print(micros());
}
count++;
}
void setup()
{
pinMode(D7,OUTPUT); //use the LED to indicate a request
digitalWrite(D7,LOW);
Spark.variable("Count", &count, INT);
/* setup our default command that will be run when the user accesses
* the root page on the server */
webserver.setDefaultCommand(&helloCmd);
/* run the same command if you try to load /index.html, a common
* default page name */
webserver.addCommand("index.html", &helloCmd);
/* start the webserver */
webserver.begin();
}
void loop()
{
char buff[64];
int len = 64;
digitalWrite(D7,LOW);
/* process incoming connections one at a time forever */
webserver.processConnection(buff, &len);
}
Just wondering, is there a known issue list which had been confirmed by Spark member ?
I had been posting number of issues but sometime confusing whether it is already known issues of just my own mistake. If there is a list which link to reported issues, it will be great.
Especially, when the forum is getting bigger everyday. Searching for a right answer if getting more difficult as some may be too long and some are not related.
It would be great if there is a status column which can indicate (open, in progress, confirm bug, feature, resolved) just like bug tracking for public.
@kennethlimcp is totally right, you can search for known issues and their status on the various github pages for the projects, as well as our new support page ( http://support.spark.io ) which can help you find official answers to commonly asked questions. Also @BDub is officially on our firmware team