GBASockClient::GBASockClient(sf::IPAddress _server_addr) { if (!_server_addr.IsValid()) server_addr = sf::IPAddress::LocalHost; else server_addr = _server_addr; client.Connect(0xd6ba, server_addr); //client.SetBlocking(false); }
void ServerTransmitter::SendUDP(unsigned short port, sf::IPAddress targetAddress, sf::Packet sendPacket) { if(targetAddress.IsValid()) { // Send a message to the server if(sender.Send(sendPacket, targetAddress, port) != sf::Socket::Done) { std::cout << "ServerTransmitter::SendUDP() error: failed to send packet to target." << std::endl; return; } // std::cout << "Message sent to client : " << targetAddress.ToString() << " on port " << port << std::endl; } }
void ShowServerIP(const sf::IPAddress& addr) { dlg->m_serveraddress.Format("Server IP address is: %s", addr.ToString()); }