Hi I was wondering if you would make a simple program that would display a blank window and would allow you to press the a key to send a message from the server to a client and visa versus.
I have been trying to get a window and some networking working but cant seem to get the input to work correctly. I have basically this:
while(1)
{
if( app.GetInput().IsKeyDown( sf::Key::A ) && key != true )
{
ToSend = "a";
key = true;
}
if( !app.GetInput().IsKeyDown( sf::Key::A ) && key != true )
{
key = true;
}
if (Client.Send(ToSend.c_str(), sizeof(ToSend.c_str())) != sf::Socket::Done)
return;
std::cout << "Message sent to the client : \"" << ToSend << "\"" << std::endl;
// Receive a message back from the client
if (Client.Receive((char*)Message.c_str(), sizeof(Message.c_str()), Received) != sf::Socket::Done)
return;
// Show the message
std::cout << "Message received from the client : \"" << Message << "\"" << std::endl;
app.Display();
}
in hopes that pressing the 'a' key would change teh sent data to "a" instead of "test" or "test client".
If you have time and it is not too much of a hassle could you put together a tutorial or some code which sends data across when you hit a key.
Thank you.
[/code]