My Community
July 25, 2014, 10:21:52 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: 6/29/2011 RakNet 4.022 released.
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  General Discussion / Programming / Re: Problems when connecting to remote server. on: June 02, 2011, 04:36:17 PM
Will do, if i can get it to work : )
2  General Discussion / Programming / Re: Problems when connecting to remote server. on: June 01, 2011, 01:34:47 AM
Ok, feel free to move the post then.
As i said, the packet do arrive to the computer hosting the server, so the firewall shoud not be the problem in this case i guess?
3  General Discussion / Programming / Problems when connecting to remote server. on: May 31, 2011, 01:33:44 PM
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:
Code:
const unsigned char MAX_CLIENTS = 10;
const unsigned int PORT = 2578;

PacketHandler pH;

// 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";
    }
    else
{
cout << "There was an error starting the server.\n";
        return 0;
    }
server->SetMaximumIncomingConnections(MAX_CLIENTS);
while (1)
{
for (packet=server->Receive(); packet; server->DeallocatePacket(packet), packet=server->Receive())
{
pH.handlePackage(server, packet);
}
}
server->Shutdown(300);
RakPeerInterface::DestroyInstance(server);
cout << "Server closed successfully.\n";

Basic game code:
Code:
#define SERVER_PORT 2578
#define SERVER_IP "localhost"

RakPeerInterface *client = RakPeerInterface::GetInstance();
Packet *packet;
client->Startup(1,&SocketDescriptor(), 1);
client->Connect(SERVER_IP, SERVER_PORT, 0,0);
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.17 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!