Connecting to Telent on local machine

Is this code right - well it compiles but throws an error saying that "ConnectException:Connection refused" - how do I get round this, all I want to do is connect to Telnet on my computer (local). Surely it cant be that hard!!!

public static void main (String args[]) throws IOException {

{ try

{InetAddress ina = InetAddress.getLocalHost();

System.out.println(ina);

Socket s = new Socket(ina, 23);

BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));

boolean more = true;

while (more)

{ String line = in.readLine();

if (line == null) more = false;

else

System.out.println(line);

}

}

catch (IOException e)

{ System.out.println("Error" + e);

}

}

}

}

[836 byte] By [earnshaw1] at [2007-9-26 2:34:38]
# 1
you Can not Connect to Telnet on your local machine unless u have Telnet Server on your local machine so try to find on you can try to find on in www.winfiles.com
usama_ra at 2007-6-29 9:59:37 > top of Java-index,Archived Forums,New To Java Technology Archive...