When I send a regular packet containing an int and two strings between these two loops everything works fine.
sf::Packet Packet;
sf::IPAddress IP;
unsigned short Port;
std::cout << "Waiting for clients..." << std::endl;
Socket.Receive(Packet, IP, Port);
std::cout << "Connection received!" << std::endl;
int Type;
if (Packet >> Type == 1)
{
std::string userName, Password;
Packet >> userName >> Password;
std::cout << "Username: " << userName << " Password: " << Password << std::endl;
}
sf::SocketUDP UDP;
sf::Packet testPacket;
int Type = 1;
std::string userName = "00";
std::string password = "00";
std::cout << "Enter username: ";
std::getline(std::cin, userName);
std::cout << "Enter password: ";
std::getline(std::cin, password);
sf::IPAddress Address = "127.0.0.1";
unsigned short portNr = 4639;
testPacket << Type << userName << password;
UDP.Send(testPacket, Address, portNr);
std::cout << "Sent Login to " << Address << ":" << portNr << std::endl;
But when I have the same client code within a client rendering a window the socket doesen't go through to the server.
The client renders a single frame with a loaded image then pauses for input from user, that's the only difference between the client I want to use and this code...
So do anyone have an idea why this would be?