Listing 1

connect = function (ip, port) {
// Opens Connection to XMLSocket Server
xsock = new XMLSocket();
xsock.onConnect = sockConnect;
xsock.onXML = processXML;
xsock.connect("12.101.101.72", "1024");
xsockStatus = "[Connecting]";
};
sockConnect = function (bool) {
// Validates whether a session has been started with Server
if (bool) {
xsockStatus = "[Starting Session]";
resetGame();
} else {
xsockStatus = "[refused]";
}
};