DCSModulesAPI
1.0.0
DCS sub project containing all the control modules as libraries.
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
sockets/simple_server.cpp
An example showing how to implement a simple server.
#include <iostream>
#include <
DCS_Core/include/DCS_ModuleCore.h
>
#include <
DCS_Utils/include/DCS_ModuleUtils.h
>
#include <
DCS_Network/include/DCS_ModuleNetwork.h
>
int
main()
{
using namespace
DCS::Network
;
// For Server and Socket
Socket
s =
Server::Create
(15777);
// This waits for a client to connect (blocking)
Socket
client = Server::WaitForConnection(s);
Server::StartThread
(client);
// Will run indefinitely until client disconnect, or...
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
// Wait one second to issue stop command
Server::StopThread
(client);
return
0;
}
Generated by
1.8.11