MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / createServer

Method createServer

source/network/ODSocketServer.cpp:39–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39bool ODSocketServer::createServer(int listeningPort)
40{
41 mIsConnected = false;
42
43 // As we use selector, there is no need to set the socket as not-blocking
44 sf::Socket::Status status = mSockListener.listen(listeningPort);
45 if (status != sf::Socket::Done)
46 {
47 OD_LOG_ERR("Could not listen to server port status="
48 + Helper::toString(status));
49 return false;
50 }
51
52 mSockSelector.add(mSockListener);
53 mIsConnected = true;
54 OD_LOG_INF("Server connected and listening");
55 mThread = new sf::Thread(&ODSocketServer::serverThread, this);
56 mThread->launch();
57
58 return true;
59}
60
61bool ODSocketServer::isConnected()
62{

Callers

nothing calls this directly

Calls 1

toStringFunction · 0.70

Tested by

no test coverage detected