Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

InetAddress, Socket  RSS feed

 
Vinicius Suarez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, i have tried to comunicate client and server.

this code works fine


But when I change and write this code:


The client and server dont comunicate and return the error:

SEVERE: null
java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
...
...

I dont know what is wrong
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:

 
Rob Spoor
Sheriff
Posts: 21047
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps the service is not listening on the loopback address 127.0.0.1. Can you connect using telnet? Open a command prompt and type "telnet 127.0.0.1 9999" to try it.
 
Vinicius Suarez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouter Oet wrote:Try this:



Thaks for the help, but it hasn't worked
 
Vinicius Suarez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:Perhaps the service is not listening on the loopback address 127.0.0.1. Can you connect using telnet? Open a command prompt and type "telnet 127.0.0.1 9999" to try it.


I cant connect.
>telnet 127.0.0.1 9999
Connecting To 127.0.0.1...Could not open connection to the host, on port 9999: Connect failed

I'll try a real test. I'm going to test in different computers.
Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!