title: Connect to Java Server problem
body: <p>I have written an ActionScript client program that tries to connect to a local java server that listens on port 8787.
   The code is the following:</p>
  
  <p><code></p>
  
  <pre><code>import flash.display.*;
  import flash.events.*;
  import flash.net.Socket;
  import flash.system.Security;
  
  public class Main extends Sprite {
  
      // Properties
  
      private var socket:Socket;
  
      // Constructor
  
      public function Main() {
  
          Security.loadPolicyFile("xmlsocket://localhost:8787");
          socket = new Socket();          
          socket.addEventListener(Event.CONNECT, onConnectHandler);
  
          socket.connect("192.168.0.3", 8787);
  
      }
  
      // Methods
  
      private function onConnectHandler(event:Event):void {
  
          trace("The socket is now connected...");
          var myspr:Sprite = new Sprite();
          myspr.graphics.beginFill(0x000000);
          myspr.graphics.drawCircle(50, 50, 60);
          myspr.graphics.endFill();
          addChild(myspr);
  
      }
  
  }
  </code></pre>
  
  <p></code></p>
  
  <p>But in the flash cs4 IDE i get the following message:</p>
  
  <p><code>
  Error #2044: Unhandled IOErrorEvent:. text=Error #2031: Socket Error.
      at Main()
  </code></p>
  
  <p>While when i drop the swf in firefox i get:</p>
  
  <p><code>
  SecurityError: Error #2010: Local-with-filesystem SWF files are not permitted to use sockets.
      at flash.net::Socket/internalConnect()
      at flash.net::Socket/connect()
      at Main()
  </code></p>
  
  <p>Note: instead of "192.168.0.3", i have also test 127.0.0.1 and localhost without success.</p>