Can't connect with telnet

I have this server:

package assign;

import java.net.*;

import java.io.*;

import java.util.*;

publicclass Server{

publicstaticvoid main(String[] args)throws IOException{

ServerSocket serverSocket =null;

// Returns an object of type interface List.

List l = Collections.synchronizedList(new ArrayList());

boolean listening =true;

try{

serverSocket =new ServerSocket(4444);

}catch (IOException e){

System.err.println("Could not listen on port: 4444.");

System.exit(-1);

}

// accept() returns a new socket.

while (listening)

new ServerThread(serverSocket.accept(),l).start();

serverSocket.close();

}

}

in winXP from the run menu I type "telnet 4444" after I have started the server. But the box disappears quickly. Why can't I connect with telnet?

[1823 byte] By [lokpesta] at [2007-10-3 3:46:29]
# 1
try "telnet localhost 4444"and do you get any exception in your server?
LRMKa at 2007-7-14 21:43:13 > top of Java-index,Java Essentials,Java Programming...
# 2
> n winXP from the run menu I type "telnet 4444"Running from a cmd -prompt (instead of directly from the run menu) will enable you to see eventual error messages (like host 4444 not being found).
BIJ001a at 2007-7-14 21:43:13 > top of Java-index,Java Essentials,Java Programming...
# 3
Try connecting with a correct IP-Address, then it will cretainly work. Like, telnet > open 192.168.170.100
CommandCalla at 2007-7-14 21:43:13 > top of Java-index,Java Essentials,Java Programming...