package org.rcsb.mmtf.update;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;

public class ServerUtils {

	
	/**
	 * General function to a ping a generic server.
	 * @param host
	 * @param port
	 * @return
	 */
	public boolean pingServer(String host, int port) {
		try (Socket socket = new Socket()) {
			socket.connect(new InetSocketAddress(host, port), 100);
			return true;
		} catch (IOException e) {
			return false; // Either timeout or unreachable or failed DNS lookup.
		}

	}
	
	/**
	 * Build the extension to the url for accessing data.
	 * @param inputCode
	 * @return
	 */
	public String generateDataExtension(String inputCode) {
		return inputCode.substring(1,3)+"/"+inputCode+"/"+inputCode+".cif.gz";
	}
}

@@ -297,16 +297,74 @@
 port) %7B%0A
+%09%09System.out.println(%22Pinging: %22+host+%22 on port: %22+port);%0A
 %09%09try (S

Print message from serverutils