Connecting as a TCP client
Communicating with other network-based services is important for some game types, to retrieve or store external data. In this recipe, we will learn how to have Torque 3D connect with a TCP server and communicate with it.
Getting ready
We will be using 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 up your favorite script editor, such as Torsion, and let's get going!
How to do it...
In the following steps, we will build an object that will handle communications with an external server:
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 TimeCheck::onDNSFailed(%this) { echo("TimeCheck: DNS Failed"); } // Callback: Connection to service has...