Date of update: 5/15/2011
XML Socket Server - eClever
write us
Novelties
Web feeds
Links of Interest
Basic instructions for use of the XML Socket Multiuser Server - eClever in Flash (AS2)

1. Object creation
First, you have to create the object XMLSocket. It can be done using the following constructor
server = new XMLSocket()

that creates a new object XMLSocket named server.

2. Methods of the object XMLSocket (connect, send, close)
2.1 Now you have to create the connection with the XML Socket Multiuser Server using the method connect. This method requires two parametres being URL and port. 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. The XTRA is only able to connect to an unoccupied port of a higher number than 1024. For the connecting to the server it is enough to insert the code
server.connect(URL, port)

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

2.2 If you want to send a certain command to the server, just use the method
server.send(msg)

For example,for logging of a user to the XML Socket Multiuser Server insert the code
msg="<protocol><login nickName='cli3' domainName='dem' domainPassword='pass1'/></protocol>"
server.send(msg)

2.3 Connection to the server can terminated at any time by using the command
server.close()


3. Administrator of events (onConnect, onXML, onClose)
The object XMLSocket uses the following two administrators of events:
3.1 Administrator of the event onConnect is called at the moment when connection to the server is finished
server.onConnect=function(success) {
        if (success) {
                     trace("Successful connection to the server");
        } else {
                    
                     trace("Unsuccessful connection to the server");
        }
 }

3.2 Administrator of the event onXML is called at the moment when the server sends some dates to the client
server.onXML=function(data) {
         trace(data);
  }

3.3 Administrator of the event onClose is called at the moment when connection with the server is interrupted
server.onClose = function() {
         trace("The client has been disconnected");
  }



© 1992-2010 Studio dmm, all rights reserved