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 :
ssock = new ServerSocket(PORT);
sock = ssock.accept();
And one computer is client:
sock = new Socket("localhost", PORT);
When run to this line. I received this error :
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)
Please help me point out, what wrong here.
Thanks :)
localhost
but other name ? – hqt