Hi,
I have a project that runs a series of functions every 5 minutes using setInterval. One of the functions creates a server that listens on port 8080. So on each 5 minute interval, I get the “EADDR in use” error. I want to refresh the content on each interval, but maybe it’s not necessary to create the server each time. That or else I could set the listener to time out. But it doesn’t seem to work. Any ideas?
function WriteHTML() {
var server = http
.createServer(function(req, res) {
res.writeHead(200, { “Content-Type”: “text/html” });
res.write("<href=%22/style.css%22>");
res.write(makeTableHTML(item, objlen + 2, i, j));
res.write(makeTableHTML(itemapi, length + 3, k, m));
res.write("");
res.end();
})
.listen(8080);
server.timeout = 250000;
}
Here is the project:
https://kcbtcinterval.glitch.me/
Thanks much!
Kevin G