• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.net.ConnectException

 
Ranch Hand
Posts: 664
Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any idea why I am getting java.net.ConnectException, running both NonBlockingServer.java, and, Client.java? Tried to use telnet to connect to port 4900 on the localhost, however, the connection fails.

Windows Firewall is off on my laptop running WinXP SP3.







Server output - Displayed when running NonBlockingServer.java
Inside default ctor
Inside startserver
Inside initialization
Abt to block on select()

Error displayed when running Client.java
java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
at Client.makeConnection(Client.java:29)
at Client.main(Client.java:109)
Inside SendMessage

Command line

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Jon>telnet localhost 4900
Connecting To localhost...Could not open connection to the host, on port 4900: C
onnect failed

C:\Documents and Settings\Jon>netstat -a

Active Connections

...
TCP armani:4900 armani:0 LISTENING
...







 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If telnet is failing as well then the problem is somewhere in your server. Ignore the client for now.

I've added some println statements but the server appears to hang on the selector().select() method.
reply
    Bookmark Topic Watch Topic
  • New Topic