Reputation: 1165
I'm making a game where a player can host an online session. I'm using SFML network library. But I want to display the IP address of the server host when it is waiting for incoming connections. How can I get this IP address? I'm looking for the internal IP address, but if it's possible to get the external IP address, that would be a bonus.
sf::TcpListener listener;
// bind the listener to a port
if (listener.listen(53000) != sf::Socket::Done)
{
// error...
}
// accept a new connection
sf::TcpSocket client;
if (listener.accept(client) != sf::Socket::Done)
{
// error...
}
Upvotes: 1
Views: 1364