title: Java : cannot connect to other computer through ad-hoc when using socket
body: <p>I have created a simple game, that two computer connect together. I have tested on same computer, no problem. When I create ad-hoc network (in Windows 7). One computer is a server, it created successfully : </p>
  
  <pre><code>ssock = new ServerSocket(PORT);
  sock = ssock.accept();
  </code></pre>
  
  <p>And one computer is client:</p>
  
  <pre><code>sock = new Socket("localhost", PORT);
  </code></pre>
  
  <p>When run to this line. I received this error : </p>
  
  <blockquote>
    <p>java.net.ConnectException: Connection refused: connect    at
    java.net.PlainSocketImpl.socketConnect(Native Method)     at
    java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)  at
    java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)   at
    java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)    at
    java.net.Socket.connect(Socket.java:529)  at
    java.net.Socket.connect(Socket.java:478)  at
    java.net.Socket.(Socket.java:375)   at
    java.net.Socket.(Socket.java:189)   at
    com.controller.MainController$GameObject.(MainController.java:78)
      at com.controller.MainController$3.run(MainController.java:180)     at
    java.lang.Thread.run(Thread.java:662)</p>
  </blockquote>
  
  <p>Please help me point out, what wrong here.</p>
  
  <p>Thanks :)</p>