Converted applicable enumerations to strongly typed enumerations.
This commit is contained in:
parent
b3b094fc91
commit
24db1dba1a
74 changed files with 1242 additions and 1251 deletions
|
@ -16,7 +16,7 @@ void runUdpServer(unsigned short port)
|
|||
sf::UdpSocket socket;
|
||||
|
||||
// Listen to messages on the specified port
|
||||
if (socket.bind(port) != sf::Socket::Done)
|
||||
if (socket.bind(port) != sf::Socket::Status::Done)
|
||||
return;
|
||||
std::cout << "Server is listening to port " << port << ", waiting for a message... " << std::endl;
|
||||
|
||||
|
@ -25,13 +25,13 @@ void runUdpServer(unsigned short port)
|
|||
std::size_t received;
|
||||
sf::IpAddress sender;
|
||||
unsigned short senderPort;
|
||||
if (socket.receive(in, sizeof(in), received, sender, senderPort) != sf::Socket::Done)
|
||||
if (socket.receive(in, sizeof(in), received, sender, senderPort) != sf::Socket::Status::Done)
|
||||
return;
|
||||
std::cout << "Message received from client " << sender << ": \"" << in << "\"" << std::endl;
|
||||
|
||||
// Send an answer to the client
|
||||
const char out[] = "Hi, I'm the server";
|
||||
if (socket.send(out, sizeof(out), sender, senderPort) != sf::Socket::Done)
|
||||
if (socket.send(out, sizeof(out), sender, senderPort) != sf::Socket::Status::Done)
|
||||
return;
|
||||
std::cout << "Message sent to the client: \"" << out << "\"" << std::endl;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ void runUdpClient(unsigned short port)
|
|||
|
||||
// Send a message to the server
|
||||
const char out[] = "Hi, I'm a client";
|
||||
if (socket.send(out, sizeof(out), server, port) != sf::Socket::Done)
|
||||
if (socket.send(out, sizeof(out), server, port) != sf::Socket::Status::Done)
|
||||
return;
|
||||
std::cout << "Message sent to the server: \"" << out << "\"" << std::endl;
|
||||
|
||||
|
@ -66,7 +66,7 @@ void runUdpClient(unsigned short port)
|
|||
std::size_t received;
|
||||
sf::IpAddress sender;
|
||||
unsigned short senderPort;
|
||||
if (socket.receive(in, sizeof(in), received, sender, senderPort) != sf::Socket::Done)
|
||||
if (socket.receive(in, sizeof(in), received, sender, senderPort) != sf::Socket::Status::Done)
|
||||
return;
|
||||
std::cout << "Message received from " << sender << ": \"" << in << "\"" << std::endl;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue