Debugging XMLSockets applications. Flash CS3 + NetBeans 6

<policy-file-request/>" + the null character.

And finally gives this error:
[FONT=Courier New]
Error: Error #2002: Operation attempted on invalid socket.
at flash.net::XMLSocket/send()
at FlashSocketsDemo_fla::MainTimeline/closeButton_Click()[/FONT]

So first I need to understand what is going on and finally then how to solve it so I can debug my application.