I don't know. If I uncomment everything is fine. I tried getlocaladdress, localhost. Tried typing it different ways like without . Tried different methods.
Yet nothing seems to work.
A friend ran this code on his computer that uses linux. He said it worked fine and connected. It might be firewall, but I disabled it and still get the same problem. I'm doing this over wifi so that might be blocking it. However, that wouldn't explain why it works when I uncomment it.
#include <SFML\Network.hpp>
#include <iostream>
#include <string>
#include <map>
#include <conio.h>
int main()
{
std::string text = "Connected to: ";
std::string sIP;
unsigned short serverport = 2000;
sf::TcpSocket socket;
std::cout<<"Enter server ip: ";
std::getline(std::cin, sIP);
sf::IpAddress ip(sIP);
socket.connect(sIP, serverport);
//sf::IpAddress ip = sf::IpAddress::getLocalAddress();
//socket.connect(ip, serverport);
system("pause");
return 0;
}