TCP/IP INTERNET GAME

Blitz3D Forums/Blitz3D Programming/TCP/IP INTERNET GAME

Ked(Posted 2006) [#1]
Hey! I have a question. How come when I start a TCP Game that the clients outside of my LAN can't connect?


b32(Posted 2006) [#2]
It could be caused by leaving the IP adres field empty. I think only local games can connect without an IP.


GfK(Posted 2006) [#3]
You need to set up port forwarding on your router. Forward whatever port you're using for your game to your LAN IP address - otherwise all the outside world can see is your global IP, and obviously the game isn't running on your router.


Carolinaaa(Posted 2006) [#4]
Yes, you have to set a static local ip for the computer of the lan running the server and then after enter your router's setup and forward the port and protocol (TCP or UDP) to the static local ip of the computer running the server.

With that you will be able the clients to send packets to your server, the problem will be after when your server answers, clients behind a firewall will have problems too. I suggest you thse things:

-If you are using UDP, use a unique port for both sending and receiving messages (yes, it works and it will avoid you many problems with the firewalls of routers)
-Also, this is very important, let's suppose you programmed your client to send and receive the UDP packets at the port 8000, well, if the client is behind a router and the server sends a udp message directly to the port 8000 of the client, many routers (of the client) will block that message because some routers translate the port to a different port number. The server has to send the udp message to the port showed by the command UDPStreamPort() if you want the client to receive the message.

Good routers maintain the same port, but lots of routers translate the port, so if your client tries to connect to your server using the port 8000, the router of the client will translate the port to the port 50000, (for example) and only if the server sends the answer to the port 50000, the router of the client will accept the udp message and forward it to the port 8000 of the computer running the server; if the server sends directly the udp message to the port 8000, the router (nasty routers) will block the udp message.


Hope this helps you, it should save you several headaches with routers.


Ked(Posted 2006) [#5]
Ok, this answers alot!!! Thanks for helping!!