0

I have a problem that has been breaking my head for over a week!
I have a Flash game that works under Python. The game works fine from localhost, but doesn't work if someone tries to play it from another computer. You can access mysql, login into the server, but can't play.

When played from localhost the firestarter first gets an entry from 127.0.0.1:80 port, unknown service.

Then when the game starts the entry change to 127.0.0.1:2001, unknown service.

When other computer try to play, get a entry in 80 port, and stops there.

Below are some file excerpts.

config.py

mysql_host = 'localhost'

mysql_user = 'root'

mysql_pass = 'pass'

root_host = 'localhost'



policy_line = '<?xml version="1.0"?><!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd"><cross-domain-policy>

<site-control permitted-cross-domain-policies="all"/><allow-access-from domain="*" to-ports="843,2001,3001,4001,5001,6001,7001,8001,9001,9002,9092" />

</cross-domain-policy>'

init.py

from policy_server import PolicyFactory
from game_server import gameFactory
from twisted.internet import reactor
def main():

    print 'Server Started...'

    reactor.listenTCP(843, PolicyFactory())

    GameServer = GameFactory('localhost', 'pt_br')

    reactor.listenTCP(1024, gameServer)
    reactor.listenTCP(2001, gameServer)
    reactor.listenTCP(3001, gameServer)
    reactor.listenTCP(4001, gameServer)
    reactor.listenTCP(6001, gameServer)
    reactor.listenTCP(7001, gameServer)
    reactor.listenTCP(8001, gameServer)
    reactor.listenTCP(9001, gameServer)
    reactor.listenTCP(9002, gameServer)
    reactor.listenTCP(9092, gameServer)
    reactor.run()
if (__name__ == '__main__'):

    main()

crossdomain.xml

<cross-domain-policy><site-control permitted-cross-domain-policies="master-only"/>
<allow-access-from domain="localhost" to-ports="843,1024,2001,3001,4001,5001,6001,7001,8001,9001,9002,9092"/>
<allow-access-from domain="http://127.0.0.1" to-ports="843,1024,2001,3001,4001,5001,6001,7001,8001,9001,9002,9092"/>
</cross-domain-policy>
Tom O'Connor
  • 27,440
  • 10
  • 72
  • 148
nmj77
  • 1
  • Ugh dude. Flash is dead. Learn HTML5 and Websockets. That's the way forward. Flash is dead. Don't be a necromancer. – Tom O'Connor Mar 03 '12 at 08:31

1 Answers1

2

Well, looking at your configuration I would say you are not listening on your WAN IP but on localhost. So if you want other people to be able to use your application from another computer you need to make sure it's listening on the WAN IP and that you do not have any firewalls in place that would prevent access to that IP.

On Ubuntu you can use ifconfig(might need to use sudo) and see what IP is given to your wlanX/ethX interface. That IP is your WAN IP.

Also, as suggested by Tom O'Connor, make sure you are not NATed on a home DSL line. If you are you will need to use port forwarding. Bear in mind that some ISP's do not allow this for ports below 1024.

Lucas Kauffman
  • 16,818
  • 9
  • 57
  • 92
  • The OP is probably on a Home ADSL connection and horribly NATted, too. – Tom O'Connor Mar 03 '12 at 08:30
  • Yes, i have ADSL connection, also have a router, and i used the router port forwarding, i don know if i did in the right way. – nmj77 Mar 03 '12 at 10:50
  • test it by doing the following: "nc -l port" make your friend on the wan use "nc yourip port" if he can connect and you can chat with eachother it works, if not you've got a mistate or your ISP blocks it. – Lucas Kauffman Mar 03 '12 at 10:51
  • nelson@nelson-Not-Specified:~$ nc -l port nc: getaddrinfo: Servname not supported for ai_socktype I've tried to use a 3G modem, the IP is dynamic, but i can access the server and login. I tried to use the my fixed IP, i could access the server from another computer, if i change the IP to 198.168.2.100 i can only access in a intranet PC. I hope i making myself clear, english is not my native language. Thanks for your time. – nmj77 Mar 03 '12 at 10:58
  • So you can from a remote computer, not in your intranet, access your server? Then normally it should be okay. – Lucas Kauffman Mar 03 '12 at 11:00
  • From another computer or intranet i can only access the mysql, login. The game only work in the server. – nmj77 Mar 03 '12 at 11:04
  • Have you changed your 'localhost' to 198.168.2.100 in your gamefactory? – Lucas Kauffman Mar 03 '12 at 11:10
  • I did so many changes, but i' ll try once more. And in the init i left " localhost"? I'll try both. – nmj77 Mar 03 '12 at 11:15
  • Same mistake, i logged in, but can't start the game, only in the server. – nmj77 Mar 03 '12 at 11:20
  • allow-access-from domain="http://127.0.0.1" to-ports="843,1024,2001,3001,4001,5001,6001,7001,8001,9001,9002,9092"/> you need to use 0.0.0.0 no ? – Lucas Kauffman Mar 03 '12 at 11:33
  • Change that to 192.168.2.100? – nmj77 Mar 03 '12 at 11:36
  • Using 192.168.2.100 or 0.0.0.0 doesn't work. – nmj77 Mar 03 '12 at 11:41