Odd behaviour with NAT/Router 
Author Message
 Odd behaviour with NAT/Router

Hi,

I'm about to finish my game which is using DirectPlay8. The game works
perfectly over LAN. But over the internet it doesn't work at all.
Npow, I have read many NAT/router topics over the internet, but none
of the solution I have read works. my game uses port 6000 for
gameplay, and 9000 for the masterserver. (DirectPlay8, Visual Basic6
SP5, Windows 2000 SP2 + All patches)

I'm using the Freesco 2.7 (LINUX) router, which is using DHCP, for
it's internet connection (to the provider). my PC is connected to this
router with a local LAN IP (192.168.0.4), hence the "NAT".

I'm connecting with the following code:
'-------------------------------------------
Public Sub ConnectMasterserver(strServerIP As String)

    Dim PlayerInfo As DPN_PLAYER_INFO
    Dim AppDesc As DPN_APPLICATION_DESC
    Dim UserString As String
    Dim Caps As DPN_CAPS

    On Error Resume Next
    objDPMasterClient.UnRegisterMessageHandler
    Set objDPMasterClient = Nothing
    Set objDPMasterClientAddress = Nothing
    Set objDPMasterServerAddress = Nothing

    On Error GoTo errorhandler

    AppDesc.guidApplication = MasterServerAppGuid
    AppDesc.lFlags = DPNSESSION_CLIENT_SERVER Or DPNSESSION_NODPNSVR
    AppDesc.SessionName = "none"

    '//Create DP8 client object
    Set objDPMasterClient = objDX.DirectPlayClientCreate

    '//Create DP address
    Set objDPMasterClientAddress = objDX.DirectPlayAddressCreate

    '//Create Server DP address
    Set objDPMasterServerAddress = objDX.DirectPlayAddressCreate

    '//Register Server message handler
    objDPMasterClient.RegisterMessageHandler frmAbout

'    Caps = objDPMasterClient.GetCaps
'    Caps.lTimeoutUntilKeepAlive = 60000
'    objDPMasterClient.SetCaps Caps, 0

    '//Configure Client address for TCP/IP
    objDPMasterClientAddress.SetSP DP8SP_TCPIP

    '//Configure Server address for TCP/IP
    objDPMasterServerAddress.SetSP DP8SP_TCPIP

    UserString = ServerAppDesc.SessionName
    PlayerInfo.Name = UserString
    PlayerInfo.lInfoFlags = DPNINFO_NAME
    objDPMasterClient.SetClientInfo PlayerInfo, DPNOP_SYNC

    objDPMasterServerAddress.AddComponentString DPN_KEY_HOSTNAME,
strServerIP
    objDPMasterServerAddress.AddComponentLong DPN_KEY_PORT,
intMasterServerPort

    objDPMasterClient.connect AppDesc, objDPMasterServerAddress,
objDPMasterClientAddress, 0, UserString, Len(UserString)

Exit Sub
errorhandler:
    Dim obj As D3DX8
    Set obj = New D3DX8
    Debug.Print "Error: " & obj.GetErrorString(Err.number)
End Sub
'------------------------------

The code looks perfect to me, and it works over the LAN perfectly.

Now, I read on multiple sites to open certain ports, what I have done
(my router always allows outside traffic, incoming needs to be
forwarded)

(Ranges, like 2300-2400)
udp,2300,2400,192.168.0.4/
tcp,2300,2400,192.168.0.4/
tcp,28800,29000,192.168.0.4/

And some specific ports:

UDP 217.123.13.71/6073 > 192.168.0.4/6073                      
UDP 217.123.13.71/9000 > 192.168.0.4/9000                      
UDP 217.123.13.71/6000 > 192.168.0.4/6000                      
TCP 217.123.13.71/2092 > 192.168.0.4/2092                      
TCP 217.123.13.71/7170 > 192.168.0.4/7170                      
TCP 217.123.13.71/6667 > 192.168.0.4/6667                      
TCP 217.123.13.71/47624 > 192.168.0.4/47624  

Now other clients on the internet simply can't connect to my
masterserver. And I think this newsgroup is one of my last options.

Does any one have alternative solutions to make the masterserver (or
gameserver for that matter) work behind my NAT? It's not essential,
but this way I can run the masterserver myself...

Thanks in advance,
Almar



Tue, 28 Dec 2004 01:31:22 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Visible property causes odd Insert behaviour

2. Odd behaviour of 'selection.find'

3. odd cint() behaviour

4. Very odd behaviour

5. Odd behaviour of Imagelist vs Picture box on Nt4

6. Odd behaviour in derived form...

7. Odd Modem behaviour on replicated database

8. Odd behaviour in enum declaration

9. Odd database behaviour

10. Cortona and VB -> odd behaviour

11. Odd behaviour of Msgbox in Form_Load

12. Very odd behaviour - is this a bug?

 

 
Powered by phpBB® Forum Software