Hi guys,
I expected the new multiplayer system to be rather easy to use, as I've done manual connection and message sending before, but I can't seem to receive the connect message on the server end. I run the server application first, and then then the client application many seconds later, both on the same PC, but pMessage is always null. I'm also receiving a value in pPeer on the client end, so it seems like there is a successful connection. Can anyone see where I have gone wrong here?
Here's what I have at the moment.
Server:
int main()
{
Window *pWindow = Window::Create( "Server", 100, 100, 400, 200, Window::Titlebar );
Server *pServer = Server::Create();
Message *pMessage;
while( true )
{
if( pWindow->Closed() || pWindow->KeyHit( VK_ESCAPE ) )
break;
pMessage = pServer->Update();
if( pMessage == nullptr )
continue;
if( pMessage->id == Message::Connect )
{
cout << "Player connected to the game." << endl;
}
pMessage->Release();
pMessage = nullptr;
}
pServer->Release();
pWindow->Release();
return 0;
}
Client:
bool App::Start()
{
m_pWindow = Window::Create( "Client", 100, 100, 800, 600, Window::Titlebar );
Client *pClient = Client::Create();
Peer *pPeer = pClient->Connect( "127.0.0.1" );
return true;
}
Thanks in advance.