Date of update: 5/15/2011

Client for XML Socket Multiuser Server

write us
Novelties
Web feeds
Links of Interest

List of methods

ErrorDialog   A preselection giving choice to show the dialogue window with error statement.
ErrorLog   A preselection giving choice to save errors to log file.
ConnectToServer     Connection to the XML Socket Multiuser Server
DisconnectFromServer     Disconnection from the XML Socket Multiuser Server
Send   Sending of a request to the XML Socket Multiuser Server

List of properties
XtraVersion   Finding out of version of XTRA dmmXSC.x32
ErrorMsg   Returning of an error during work with the XTRA
IsNoError   A test to find out if an error occured during work with the XTRA

List of events
Connected   The event is evoked at the moment when the client succeeded in logging to the XML Socket Multiuser Server
Disconnected   The event is evoked at the moment when the client was disconnected from the XML Socket Multiuser Server.
DataXML   The event is evoked at the moment when the XML Socket Multiuser Server sends a message to the client.
ResponseXML   The event is initianed at the moment when the XML Socket Multiuser Server sends a message "response" to the client.
ReceivedXML   The event is initianed at the moment when the XML Socket Multiuser Server sends a message "received" to the client.


Description of methods
-----------------------------------------------------------------------------------------------------------------------------------------------------------

void=ErrorDialog(dialog: boolean)
Using this function we can set whether a dialogue window, showing error statement appears at the moment of an error or not. This setting only functions in Autor mode and it simplifies the application debugging. If you decide not to set the dialogue window you can check the errors using the function errorMsg().

Parametres
Dialog is the only parameter of the function, whose type is boolean. If the value is true, the dialogue window with error statement is opened with every error in the XTRA. For the parameter value false the window is not shown. Default setting is dialog=false.

Example - Director
sprite(1).errorDialog(true)

Example - Authorware
CallSprite(@"XML Socket Client"; #errorDialog; true)

-----------------------------------------------------------------------------------------------------------------------------------------------------------

void=ErrorLog(logFile: string, logSave: boolean)
Using this function we can set whether an error is saved to text log file at the time of the error or not. This setting only functions in Autor mode and it simplifies the application debugging.

Parametres
The function has two parametres. The parameter logFile represents name of the log file that we want to save the errors to. Type of the logSave parametre is boolean. If its value is true, every error in the XTRA is saved to log file. If its value is false nothing will be saved. Default setting is logSave=false.

Example - Director
sprite(1).errorLog(the pathName&"log.txt", true)

Example - Authorware
CallSprite(@"XML Socket Client"; #errorLog; FileLocation ^ "log.txt"; true)

-----------------------------------------------------------------------------------------------------------------------------------------------------------

void=connectToServer( url: string, port:string)
This method is to connect to the XML Socket Multiuser Server.

Parametres
This method has two parametres. URL is address of the computer where the XML Socket Multiuser Server is run and port is name of the port on which the server checks if a user has been connected.

Example - Director
If you want, for example, to connect to an XML Socket Multiuser Server that is run on the same computer as the client and that uses port number 2727, it is enough to insert
sprite(1).connectToServer("localhost", 2727)

Example - Authorware
CallSprite(@"XML Socket Client"; #connectToServer ; "127.0.0.1"; 2727)

-----------------------------------------------------------------------------------------------------------------------------------------------------------

void=disconnectFromServer( )
This method quits the connection with the XML Socket Multiuser Server.

Parametres
This method has no parametres.

Example - Director
sprite(1).disconnectFromServer()

Example - Authorware
CallSprite(@"XML Socket Client"; #disconnectFromServer)

-----------------------------------------------------------------------------------------------------------------------------------------------------------

void=send( xml: string)
This method sends a request to the XML Socket Multiuser Server in the XML format.

Parametres
This method has a parameter xml, whose type is string and we insert here the request we want to send to the server. The request must be in a correct format that can be received by the XML Socket Multiuser Server.

Example - Director
sprite(1).send("<protocol><roomList sid='7'/></protocol> ")

Example - Authorware
CallSprite(@"XML Socket Client"; #send ; "<protocol><roomList sid='7'/></protocol> ")

-----------------------------------------------------------------------------------------------------------------------------------------------------------

Description of properties
-----------------------------------------------------------------------------------------------------------------------------------------------------------

list=xtraVersion
The property returns information about the XTRA dmmXSC. The property returns values in the format Abstract Data Types:
[#fileType: "Xtra (32)",
 #CompanyName: "Studio dmm",
 #FileDescription: "XML Socket Client",
 #FileVersion: "1.2.0.17",
 #InternalName: "dmmXSC.x32",
 #LegalCopyRight: "© 1992-2005 Studio dmm",
 #LegalTradeMarks: "Studio dmm",
 #OriginalFileName: "dmmXSC.x32",
 #productName: "dmmXSC.x32",
 #productVersion: "1.2.0.0"]

The meaning of the items is clear and it is not necessary to describe it closer.

Example - Director
version=sprite(1).xtraVersion

Example - Authorware
version:=CallSprite(@"XML Socket Client"; #xtraVersion)

-----------------------------------------------------------------------------------------------------------------------------------------------------------

string=errorMsg
Using the feature errorMsg we get text of the error that occured during work with the XTRA. If no error occured during the operation an empty chain is given back.

Example - Director
sprite(1).connect("localhost", 2277)
error=sprite(1).errorMsg
if error="" then
  ...
end if

Example - Authorware
error:=CallSprite(@"XML Socket Client"; #errorMsg)

-----------------------------------------------------------------------------------------------------------------------------------------------------------

boolean=isNoError
Using the feature isNoError we find out if the operation passed without any error. If so, the value true is given back.

Example - Director
sprite(1).connect("localhost", 2277)
if sprite(1).isNoError then
  ...
end if

Example - Authorware
isError:=CallSprite(@"XML Socket Client"; #isNoError)

-----------------------------------------------------------------------------------------------------------------------------------------------------------

Description of events
-----------------------------------------------------------------------------------------------------------------------------------------------------------

Connected

The event is evoked at the moment when the client succeeded in logging to the XML Socket Multiuser Server.

Example - Director
on connected me
     put "Connected"
end

Example - Authorware
Look at the demo version ( type=event)

-----------------------------------------------------------------------------------------------------------------------------------------------------------

Disconnected
The event is evoked at the moment when the client was disconnected from the XML Socket Multiuser Server.

Example - Director
on disconnected me
     put "Disconnected"
end

Example - Authorware
Look at the demo version ( type=event)

-----------------------------------------------------------------------------------------------------------------------------------------------------------

DataXML me, xml
The event is evoked at the moment when the XML Socket Multiuser Server sends a message to the client. This event is initiated alwayes when any message from the XML Socket Multiuser Server is received. This message is in the xml format.

Example - Director
on dataXML me, xml
     put xml
end

Example - Authorware
Look at the demo version ( type=event)

-----------------------------------------------------------------------------------------------------------------------------------------------------------


ResponseXML me, xml, action, sid, errorCode
The event is initianed at the moment when the XML Socket Multiuser Server sends a message "response" to the client. The event returns the values xml, action, sid and errorCode. Xml, action and sid are of the string type, errorCode is of the integer type. Description and definition of variables can be found in the protocole for use of the XML Socket Multiuser Server.

Note: Simoultaneously with this event  the event  DataXML is also initiated.

Example - Director
on responseXML me, xml, action, sid, errorCode
     put xml
     put action
     put sid
     put errorCode
end

Example- Authorware
Look at the demo version ( type=event)

-----------------------------------------------------------------------------------------------------------------------------------------------------------

ReceivedXML me, xml, action, sentFrom
The event is initianed at the moment when the XML Socket Multiuser Server sends a message "received" to the client.
The event returns the values xml, action and sentFrom. Xml, action and sentFrom are of the string type.
Description and definition of variables can be found in the protocole for use of the XML Socket Multiuser Server.

Note. Simoultaneously with this event the event DataXML is also initiated.

Example - Director
on receivedXML me, xml, action, sentFrom
     put xml
     put action
     put sentFrom
end

Example - Authorware
Look at the demo version ( type=event)




© 1992-2010 Studio dmm, all rights reserved