What's New in Director 8.5 > Using the Shockwave Multiuser Server and Xtra > Creating multiuser movies > Creating text connections

 

Creating text connections

Another way the Multiuser Xtra can communicate is through text-based servers such as Internet Relay Chat, Internet mail servers, or even proprietary text-based servers. These servers are called text-based because they respond to simple text commands that are used to control them. You make a text-based server connection by adding the integer 1 or the symbol #text to the end of the connectToNetServer() command, depending on which form of connectToNetServer() you are using. This statement tells the Xtra to enter text mode:

errCode = gMultiuserInstance.connectToNetServer("Bob", \
"MySecret", "mailserver.mycompany.com", 110, "Tech Chat", 1)

or

errorCode = gMultiuserInstance.connectToNetServer \
("mailserver.mycompany.com", 110, [#userID: "Bob", #password: \
"MySecret", #movieID: "Tech Chat"], #text)

The port number must also change to reflect the port your text-based server is using for communication. In this example the port is 110, which is commonly used with Internet mail servers. Consult the documentation for your text-based server to determine which port it uses.

In Shockwave, if a user tries to make a text-based connection to a text server that resides in a different domain name than the connecting movie, a security dialog box appears on the user's computer.

After the connection is made, you issue commands to your server with sendNetMessage(). Use System as the recipient and place your command into the content parameter. The subject parameter will be ignored. The following example sends a command to a mail server to retrieve the first piece of mail in the mailbox.

command = "RETR 1" & RETURN
errCode = gMultiuserInstance.sendNetMessage("System", \
"anySubject", command)

The server responds with whatever data is appropriate. The Xtra retrieves the data as the #content property of a typical incoming message property list.