     import flash.events.SecurityErrorEvent;
     import flash.net.XMLSocket;
     import flash.system.System;
+    import flash.utils.getTimer;
     import flash.utils.getQualifiedClassName;
     import flash.sampler.*;
 

                case "GET MEMORY":
                    _socket.send("MEMORY: " + new Date().time + " " + System.totalMemory);
                    return;
                case "START SAMPLING":
                    startSampling();
                    _socket.send("OK START");
                    return;
                case "PAUSE SAMPLING":
                    pauseSampling();
                    _socket.send("OK PAUSE");

                    trace(getSampleCount());
                    for each (var s:Sample in getSamples()) {
                        trace(sampleToString(s));
                    }
                    return;
                case "STOP SAMPLING":
                    stopSampling();
                    _socket.send("OK STOP");
                    return;
                case "GET SAMPLES":
                    _socket.send("SENDING SAMPLES: " + )
    	    }
    	}
    	

                var nos:NewObjectSample = s as NewObjectSample;
                
                return "[NewObjectSample" +
                    "\n   time: " + nos.time +
                    "\n     id: " + nos.id +
                    "\n   type: " + getQualifiedClassName(nos.type) +
                    stackToString(nos.stack) +
                    "\n]";
                    
            } else if( s is DeleteObjectSample ) {
                var dos:DeleteObjectSample = s as DeleteObjectSample;
                
                return "[DeleteObjectSample" +
                    "\n   time: " + dos.time +
                    "\n     id: " + dos.id +
                    "\n   size: " + dos.size +
                    stackToString(dos.stack) +
                    "\n]";
            }

            return "[Sample" +
                "\n   time: " + s.time +
                stackToString(s.stack) +
                "\n]";
    	}
    	
    	private function stackToString(stack:Array):String {
    	    if( null == stack ) {
    	        return "";
    	    }
    	    
    	    var separator:String = "\n    ";
    	    return "\n  stack: " + separator + stack.join(separator);
    	}
    	
    	private function connect():void {
