- retrieving home dir and create FsTrack folder
- added adjustable KML update interval - prepared for .kmz git-svn-id: http://moon:8086/svn/software/trunk/projects/FsTrack@125 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+13
-7
@@ -1,8 +1,9 @@
|
||||
#include "HttpServer.hpp"
|
||||
|
||||
|
||||
HttpServer::HttpServer(const char *pDocDir)
|
||||
HttpServer::HttpServer(int port, const char *pDocDir)
|
||||
: Thread("Http")
|
||||
, m_port(port)
|
||||
, m_docDir(pDocDir)
|
||||
{
|
||||
startThread();
|
||||
@@ -51,16 +52,19 @@ const char* HttpServer::getDocName(char *buffer, int buflen)
|
||||
}
|
||||
pDocname[i] = 0;
|
||||
|
||||
if (i==0)
|
||||
return nullptr;
|
||||
|
||||
return docBuffer;
|
||||
}
|
||||
|
||||
void HttpServer::run()
|
||||
{
|
||||
char buffer[1024];
|
||||
char docname[1024];
|
||||
|
||||
ScopedPointer<StreamingSocket> listenSock = new StreamingSocket();
|
||||
listenSock->bindToPort(5001);
|
||||
listenSock->createListener(5001);
|
||||
listenSock->createListener(m_port);
|
||||
|
||||
while(!threadShouldExit())
|
||||
{
|
||||
@@ -76,13 +80,15 @@ void HttpServer::run()
|
||||
pDoc = getDocName(buffer, numRead);
|
||||
if (!pDoc)
|
||||
{
|
||||
pSock->close();
|
||||
continue;
|
||||
pDoc = docname;
|
||||
sprintf(docname, "%s\\FsTrack\\welcome.htm", m_docDir);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_listeners.call(&IHttpListener::onUpdate, pDoc);
|
||||
}
|
||||
}
|
||||
|
||||
m_listeners.call(&IHttpListener::onUpdate, pDoc);
|
||||
|
||||
ScopedPointer<juce::File> file = new juce::File(pDoc);
|
||||
if (!file)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user