I've tried this using AppGameKit 2017.03.31 tier 1 & 2, and on two different PCs - one running W7 Ultimate, one W7 Professional - both 64 bit. As soon as the code hits the CloseNetwork command, the app just locks up. Here's a
link to another thread where I explained in more detail what I'm trying to do.
The same problem occurs in the
example code for JoinNetwork.
The snippet from my tier 2 code:
// find a host or become one.
_networkId = agk::JoinNetwork("tanks", "client");
float t = agk::Timer();
bool connected = false;
do
{
agk::PrintC("Searching for host...");
connected = (agk::GetNetworkNumClients(_networkId) > 0);
switch (connected)
{
case true:
agk::Print("found.");
// found a host, so we're a client.
_netState = iAmClient;
_theServerId = agk::GetNetworkServerID(_networkId);
break;
case false:
// no host found, but give it two seconds...
if ((agk::Timer() - t > 2) && !connected)
{
agk::Print("not found, so hosting.");
agk::CloseNetwork(_networkId);
agk::Sync();
// ...and then become the host.
_networkId = agk::HostNetwork("tanks", "host", 1041);
_netState = iAmHost;
connected = true;
}
break;
}
agk::Sync();
} while (!connected);
// now we're connected, get our client ID.
_myClientId = agk::GetNetworkMyClientID(_networkId);