private Socket connect () {
	    Socket s = null;
	    int attempts = 0;
	    do {
		attempts ++;
		try {
		    s = new Socket(host, port);
		    s.setKeepAlive(true);
		    s.setSoTimeout(0);

		} catch (Exception e) {
		    String msg =
			String.format("Warning: connection attempt %d to %s failed.",
				      attempts, getInfo());
		    System.err.println(msg);
		    System.err.println(e.getMessage());
		    try {
			Thread.sleep(random.nextInt(100) + 1); /* [0..100] + 1 > 0.*/
		    } catch (InterruptedException ignored) {}
		}
	    } while (s == null);
	    return s;
	}