SFML/examples/voip/VoIP.cpp
Stefan Schindler 40ae3ce175 Examples adjustments.
* French to English punctuation.
* Pong and Shader use fixed-sized windows now (especially on tiling
  window managers, the windows will be resized automatically, thus
  making the examples look and also behave weirdly).
2014-11-17 09:44:46 +01:00

51 lines
1.2 KiB
C++

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <iomanip>
#include <iostream>
#include <cstdlib>
////////////////////////////////////////////////////////////
// Function prototypes
// (I'm too lazy to put them into separate headers...)
////////////////////////////////////////////////////////////
void doClient(unsigned short port);
void doServer(unsigned short port);
////////////////////////////////////////////////////////////
/// 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 ?
char who;
std::cout << "Do you want to be a server ('s') or a client ('c')? ";
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(10000, '\n');
return EXIT_SUCCESS;
}