 ~Sockets~
|
C++ Socket library tutorial
|
|
Using the StatusSocket as a Server
Server implementation
This is the server for the StatusSocket.
It works exactly as the earlier server example, it only Bind()'s to another
port.
statusserver.cpp
#include <SocketHandler.h>
#include <ListenSocket.h>
#include "StatusSocket.h"
static bool quit = false;
int main()
{
SocketHandler h;
ListenSocket<StatusSocket> l(h);
if (l.Bind(9002))
{
exit(-1);
}
Utility::ResolveLocal(); // resolve local hostname
h.Add(&l);
h.Select(1,0);
while (!quit)
{
h.Select(1,0);
}
}
|
|
|