Using the DirectPlay DPNSVR Application
Microsoft Windows does not allow multiple processes to share a single IP or IPX port. Each application that wants to act as a communication host must use a separate port. This restriction creates several issues, especially when doing such tasks as enumerating running games:
- Avoiding port conflicts. You must choose a port that does not conflict with other applications.
- Managing multiple communications hosts on a single system. Each instance of a host must use a different port. Client applications then have to determine which port a particular host is using.
- Avoiding ports that are already in use. If your preferred port is in use, your application must be able to use another port.
The DPNSVR application addresses these issues by acting as a forwarding service for enumeration requests. When an application begins hosting, it informs DPNSVR which port it is running on. DPNSVR listens on a well-known port, and forwards any enumeration requests to all Microsoft® DirectPlay® hosts on the system. Responses to enumeration requests contain the actual port that the host is connected to. DPNSVR offers developers the following advantages:
- You can write generic enumeration routines that enumerate all the games running on a particular system.
- You can use DirectPlay to select the host's port. Client applications can use the services of DPNSVR to enumerate the running games on a well-known port, and the responses will contain the actual port that the host is connected to.
- You do not have to allow for the situation where your application does not get the port it requests.
- You do not need to be concerned about conflicts with other applications on the system
While most applications will want to use the services of DPNSVR, there are some circumstances where you may want to disable it. Two examples are:
- You know what port you want to use, and only one instance of your application will be running on the computer.
- You want to restrict the ability of players to enumerate your session. If you disable DPNSVR, only those players that know the port that your host is connected to will be able to enumerate your host.
For more information, see How to Use DPNSVR.