Connecting as an HTTP client
Communicating with an HTTP server can be quite useful for a game. An HTTP server could provide a login service or storage for a game's high scores.
In this recipe, we will learn how to have Torque 3D retrieve data from an HTTP service that returns our external network IP address.
Getting ready
We will be making TorqueScript changes in a project based on the Torque 3D's Full
template, using the Empty Terrain
level. If you haven't already, use the Torque Project Manager (Project Manager.exe
) to create a new project from the Full
template; it will be found under the My Projects
directory. After that, start your favorite script editor, such as Torsion, and let's get going!
How to do it...
In the following steps, we will connect with an HTTP server that will give us our network IP address:
Open the
scripts/server/game.cs
file in your text editor, add the following code to the bottom of the file, and save:// Callback: Cannot resolve name function IPCheck::onDNSFailed(%this...