1
0
mirror of https://github.com/SFML/SFML.git synced 2025-03-14 01:40:05 +08:00

41 lines
958 B
C++
Raw Normal View History

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
2024-09-23 13:55:33 -06:00
#include "Client.hpp"
#include "Server.hpp"
2024-09-23 13:55:33 -06:00
#include <iostream>
////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Choose a random port for opening sockets (ports < 1024 are reserved)
const unsigned short port = 2435;
// Client or server ?
2024-04-27 06:44:27 +00:00
char who = 0;
std::cout << "Do you want to be a server ('s') or a client ('c')? ";
2022-07-04 11:20:58 -05:00
std::cin >> who;
if (who == 's')
{
// Run as a server
doServer(port);
}
else
{
// Run as a client
doClient(port);
}
// Wait until the user presses 'enter' key
std::cout << "Press enter to exit..." << std::endl;
std::cin.ignore(10'000, '\n');
}