onData

I have been piecing some code together to try to get this working and am still having some problems, I can get the connection to establish but I cannot get the onData function to work. If anyone has any insight to this it would be greatly appreciated!

function lsOnConnect(success) {
if (success) {
trace (“Connection succeeded!”)
} else {
trace (“Connection failed!”)
}
}

var socket = new XMLSocket();
socket.onConnect = lsOnConnect
if (!socket.connect(‘ipnumber’, 0000)) {
trace (“Connection failed!”)
}

socket.onData = function(success){
if (success){
trace (“loaded”);
}
else {
trace(“XML did not load”);
}
}