public Socket accept() throws IOException { Socket s = super.accept(); s.setSoTimeout(1000); TimeoutSocket ts = new TimeoutSocket(s); return ts; } }
/** * Create a server socket on the specified port (port 0 indicates * an anonymous port). * @param port the port number * @return the server socket on the specified port * @exception java.io.IOException if an I/O error occurs during server socket * creation * @since 1.2 */ public Socket createSocket(String host, int port) throws IOException { Socket s = new Socket(host, port); s.setSoTimeout(1000); TimeoutSocket ts = new TimeoutSocket(s); return ts; }