reference: WebSocket

git-svn-id: svn://ultimatepp.org/upp/trunk@6708 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2013-12-31 18:12:37 +00:00
parent f65a99f7ed
commit 5ba2e29db2
7 changed files with 79 additions and 1 deletions

View file

@ -0,0 +1,27 @@
#include "Core/Core.h"
using namespace Upp;
// Open demo.html in browser, run this app, push the button...
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_COUT|LOG_FILE);
TcpSocket server;
if(!server.Listen(8888)) {
LOG("Failed to start listening on 8888..");
return;
}
for(;;) {
WebSocket ws;
if(ws.WebAccept(server)) {
LOG("Accepted connection");
LOG(ws.Recieve());
ws.SendText("Hello browser!");
}
if(ws.IsError())
LOG("ERROR: " << ws.GetErrorDesc());
}
}