i plan to develop only a litte network application, something similar to a chat. and so i downloaded xampp for home windows and installed it (also as service), mysql incorporated. well, i began the apache (and mysql) as service and merely authored rapid line in java:

 try {
     Socket sock = new Socket("", 21);
     System.out.println("connection established");
 } catch ( UnknownHostException e ) {
     System.out.println("Can't find host.");
 } catch ( IOException e ) {
     System.out.println("Error connecting to host. " + e.toString());

but directly i acquired the solution:

Error connecting to host. java.net.ConnectException: Connection refused: connect

the server is runnin'. the localhost is obtainable around the browser.

did i didn't remember something? any ideas?

Inside your java code you are attempting to connect with port 21 (ftp). Have no idea what for you to do, but possibly you should attempt port 80 (http).

Have you download and install the Tomcat add-on for XAMPP? It isn't area of the default install.

After it's removed in to the XAMPP folder you need to run first setup_xampp.softball bat after which tomcat_start.softball bat.

Also, Tomcat in XAMPP uses the 8080 port automatically.