Hello, im currently developing a simple game using RakNet. Everything went fine until i tried connecting to the server when the server was on another PC.
Working as it should when using "localhost" but when using the IP on the remote computer it wont connect. I have checked with an network sniffer software that the packages arrives. Also tried with my own PC using my own IP instead of "localhost" and it wont work. Only works with "localhost", what am i doing wrong?
Basic server code:
const unsigned char MAX_CLIENTS = 10;
const unsigned int PORT = 2578;
// Set up server
RakPeerInterface *server = RakPeerInterface::GetInstance();
Packet * packet = NULL;
if(server->Startup(MAX_CLIENTS, &SocketDescriptor(PORT,""), 1) == RAKNET_STARTED)
cout << "Server started successfully.\n";
cout << "There was an error starting the server.\n";
for (packet=server->Receive(); packet; server->DeallocatePacket(packet), packet=server->Receive())
cout << "Server closed successfully.\n";
Basic game code:
#define SERVER_PORT 2578
#define SERVER_IP "localhost"
RakPeerInterface *client = RakPeerInterface::GetInstance();
client->Connect(SERVER_IP, SERVER_PORT, 0,0);