Advertisement

DXSDK DPlay HostMigration Tutorial bug

Started by October 17, 2003 11:27 AM
3 comments, last by curlious 21 years, 3 months ago
I have been going through the Peer to Peer tutorials in the DXSDK under Direct play and noticed somthing about the host migration tutorial. If you establish a host then create two other peers then disconnect the host, host migration occures but then when you try to enumerate the hosts from another peer no hosts are found. Seems like a bug to me try it out and let me know if you get the same results.
> {...} try to enumerate the hosts from another peer
> no hosts are found.

Scenario: Machine A is the session host and machines B and C join in. Machine A goes away and machine B is elected host. Machine D tries to find the host and can''t find any.

Here are possible causes:

1) If you try to enumerate hosts on A then you won''t find any; normal since it''s gone.

2) If you try to enumerate hosts on B and B is behind a firewall, then you won''t find any unless either the DPNSVR ports or the fixed port you have specified for B is opened in the router. This is normal since B joined the session, not the one that created it; it''s port number may have changed across the firewall and it''s no longer ''visible'' from the outside world. That may explain the odd behaviour.

3) If you try to find a host on a machine and looking for a specific port, it''s possible you won''t find it if the session is using DPNSVR for port assignments.

> try it out and let me know if you get the same results.

I tried SimplePeer with 3 machines plugged on the same router and don''t have any problem. If I do the same thing with 3 instances on the same machine I don''t have a problem either, but I have to use DPNSVR and erase the port# when looking up hosts.

Hope this helps.

-cb
Advertisement
I think I must be experiencing the first problem. Right now I am just running three instances of the same application on one machine.

New to all this I looked up DPNSVR and found this little note at the end....

Note Applications can always enumerate your host if they know the port on which it is running, even if the DPNSESSION_NODPNSVR flag is set.

Since the port is assigned I am still a little confused why the app does not work properly and not sure what I must change to get it to work. No big deal for now, but if I ran into this problem designing my own app I would have problems. The program does turn off DPNSVR by setting the application description flag in the hosting section. I'll be sure to follow your advice at the end if I design my own app.

[edited by - curlious on October 17, 2003 4:55:49 PM]
> Since the port is assigned I am still a little
> confused why the app does not work properly

Instance A assigns the port # since it is hosting on it. All other instances have to bind to other ports. When A goes away and B gets elected host, then A''s port # is no longer the reference for enumeration; it should be B''s but you don''t know it since it was dynamically assigned when B *joined* the session. The only way around this is *not* to look for a port but to look for any running game on a specific machine and filter by its application GUID.

In the DPN_APPLICATION_DESC struct, just set the guidApplication field and set the others to 0. In the address you pass to EnumHosts(), just set the SP for CLSID_DP8SP_TCPIP and the DPNA_KEY_HOSTNAME field for the machine name you wish to enumerate from and nothing more. That will tell EnumHosts() to look for any running session matching your application GUID on that particular machine. If you don''t set DPNA_KEY_HOSTNAME, then you will enumerate from the ''localhost'', the machine EnumHost() is being called from.

-cb
Thanks for the information. I alterd the tutorial following the directions you supplied and it is working now. To recapitulate: By enabling DPNSVR under the Application Descripitions dwFlags in the Host() function you are telling it to look for running applications at the given address sent to EnumHosts( &dpAppDesc, g_pHostAddress,g_pDeviceAddress,...) since it looks for the ap by the GUID it doesn''t need a port number to be specified, correct? Finally by leaving the DPN_KEY_HOSTNAME unset the peer will enumerate from the localhost, you would only want to do this if the host and other peers where all on the same machine.(i''ll have to try commenting out the code to add that component and see if it still works.)

This topic is closed to new replies.

Advertisement