title: Java Socket permission : applet isn't initialized
body: <p>Following is the part of my error. Because of this error my applet isn't initialized. The following code is part of the init() method:</p>
  <pre class="lang-java prettyprint-override"><code>    Socket sock;
      try {
          sock = new Socket(&quot;localhost&quot;, 1307);
          out = new PrintWriter(sock.getOutputStream(), true);
          in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
      }
      catch (UnknownHostException e) { }
      catch (IOException e) { }
  </code></pre>
  <p>I m getting the following error:</p>
  <pre><code>java.security.AccessControlException: access denied (java.net.SocketPermission 1
  127.0.0.1 resolve)
          at java.security.AccessControlContext.checkPermission(AccessControlConte
  xt.java:323)
          at java.security.AccessController.checkPermission(AccessController.java:
  546)
          at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
          at java.lang.SecurityManager.checkConnect(SecurityManager.java:1031)
          at java.net.InetAddress.getAllByName0(InetAddress.java:1145)
          at java.net.InetAddress.getAllByName(InetAddress.java:1083)
          at java.net.InetAddress.getAllByName(InetAddress.java:1019)
          at java.net.InetAddress.getByName(InetAddress.java:969)
          at java.net.InetSocketAddress.&lt;init&gt;(InetSocketAddress.java:124)
          at java.net.Socket.&lt;init&gt;(Socket.java:186)
          at Alice.init(Alice.java:103)
          at sun.applet.AppletPanel.run(AppletPanel.java:424)
          at java.lang.Thread.run(Thread.java:619)
  </code></pre>
  <p>I am running another program on another JVM. I am trying to connect both using 1307 port on localhost.</p>