Changed internal naming convention (local variables now start with a lower case character)

Removed the AudioResource class

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1166 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
LaurentGom 2009-07-11 22:17:24 +00:00
parent 7cc00085d8
commit 45b150648d
245 changed files with 7865 additions and 8065 deletions

View file

@ -10,44 +10,44 @@
/// Create a client and connect it to a running server
///
////////////////////////////////////////////////////////////
void DoClientTCP(unsigned short Port)
void DoClientTCP(unsigned short port)
{
// Ask for server address
sf::IPAddress ServerAddress;
sf::IPAddress serverAddress;
do
{
std::cout << "Type address or name of the server to connect to : ";
std::cin >> ServerAddress;
std::cin >> serverAddress;
}
while (!ServerAddress.IsValid());
while (!serverAddress.IsValid());
// Create a TCP socket for communicating with server
sf::SocketTCP Client;
sf::SocketTCP client;
// Connect to the specified server
if (Client.Connect(Port, ServerAddress) != sf::Socket::Done)
if (client.Connect(port, serverAddress) != sf::Socket::Done)
return;
std::cout << "Connected to server " << ServerAddress << std::endl;
std::cout << "Connected to server " << serverAddress << std::endl;
// Receive a message from the client
char Message[128];
std::size_t Received;
if (Client.Receive(Message, sizeof(Message), Received) != sf::Socket::Done)
char message[128];
std::size_t received;
if (client.Receive(message, sizeof(message), received) != sf::Socket::Done)
return;
// Show it
std::cout << "Message received from server : \"" << Message << "\"" << std::endl;
std::cout << "Message received from server : \"" << message << "\"" << std::endl;
// Define a message to send back to the server
char ToSend[] = "Hi, I'm a client !";
char toSend[] = "Hi, I'm a client !";
// Send the message
if (Client.Send(ToSend, sizeof(ToSend)) != sf::Socket::Done)
if (client.Send(toSend, sizeof(toSend)) != sf::Socket::Done)
return;
std::cout << "Message sent to server : \"" << ToSend << "\"" << std::endl;
std::cout << "Message sent to server : \"" << toSend << "\"" << std::endl;
// Close the socket when we're done
Client.Close();
client.Close();
}
@ -55,39 +55,39 @@ void DoClientTCP(unsigned short Port)
/// Launch a server and wait for incoming connections
///
////////////////////////////////////////////////////////////
void DoServerTCP(unsigned short Port)
void DoServerTCP(unsigned short port)
{
// Create a TCP socket for communicating with clients
sf::SocketTCP Server;
sf::SocketTCP server;
// Listen to a port for incoming connections
if (!Server.Listen(Port))
if (!server.Listen(port))
return;
std::cout << "Server is listening to port " << Port << ", waiting for connections... " << std::endl;
std::cout << "Server is listening to port " << port << ", waiting for connections... " << std::endl;
// Wait for a connection
sf::IPAddress ClientAddress;
sf::SocketTCP Client;
if (Server.Accept(Client, &ClientAddress) != sf::Socket::Done)
sf::IPAddress clientAddress;
sf::SocketTCP client;
if (server.Accept(client, &clientAddress) != sf::Socket::Done)
return;
std::cout << "Client connected : " << ClientAddress << std::endl;
std::cout << "Client connected : " << clientAddress << std::endl;
// Send a message to the client
char ToSend[] = "Hi, I'm the server";
if (Client.Send(ToSend, sizeof(ToSend)) != sf::Socket::Done)
char toSend[] = "Hi, I'm the server";
if (client.Send(toSend, sizeof(toSend)) != sf::Socket::Done)
return;
std::cout << "Message sent to the client : \"" << ToSend << "\"" << std::endl;
std::cout << "Message sent to the client : \"" << toSend << "\"" << std::endl;
// Receive a message back from the client
char Message[128];
std::size_t Received;
if (Client.Receive(Message, sizeof(Message), Received) != sf::Socket::Done)
char message[128];
std::size_t received;
if (client.Receive(message, sizeof(message), received) != sf::Socket::Done)
return;
// Show the message
std::cout << "Message received from the client : \"" << Message << "\"" << std::endl;
std::cout << "Message received from the client : \"" << message << "\"" << std::endl;
// Close the sockets when we're done
Client.Close();
Server.Close();
client.Close();
server.Close();
}