KeepAliveSocketImpl.java |
// Cette classe d'implantation doit faire partie du paquetage java.net // puisque la classe dont elle hérite n'est pas publique package java.net; import java.io.*; /** * Classe d'implantation des sockets respectant la version 5 de SOCKS. */ public class KeepAliveSocketImpl extends PlainSocketImpl { KeepAliveSocketImpl() { super(); } KeepAliveSocketImpl(FileDescriptor fd) { super(fd); } protected void create(boolean stream) throws IOException { super.create(stream); try { setOption(java.net.SocketOptions.SO_KEEPALIVE,new Boolean(true)); } catch(SocketException e) { System.err.println(e); } } }