Exemple #1
0
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);
}
Exemple #2
0
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;
	}
}