src/main/java/com/nsslawsproject/awsserver/PingReceiver.java
@Override
	public void run() {
		super.run();
		
		try {
			ServerSocket serverSocket = new ServerSocket(6666); // listening on port 6666 for ELB pings
			Socket pingSocket = null;
			BufferedWriter buf = null;
			while(mRun) {
				pingSocket = serverSocket.accept();
				buf = new BufferedWriter(new OutputStreamWriter(pingSocket.getOutputStream()));
				buf.write("ACK\n"); // returning ACK to the ELB although this is not needed...
				buf.flush();
				buf.close();
				pingSocket.close();
			}
			serverSocket.close();
		} catch (IOException e) {
			// in case of an exception the ping receiver will stop
			e.printStackTrace();
		}
	}
// keep running the ping receiver while mRun is true
keep running the ping receiver while mRun is true
keep running the ping receiver while mRun is true
@Override
	public void run() {
		super.run();
		try {
			ServerSocket serverSocket = new ServerSocket(6666); 
			Socket pingSocket = null;
			BufferedWriter buf = null;
			while(mRun) {
				pingSocket = serverSocket.accept();
				buf = new BufferedWriter(new OutputStreamWriter(pingSocket.getOutputStream()));
				buf.write("ACK\n"); 
				buf.flush();
				buf.close();
				pingSocket.close();
			}
			serverSocket.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
@ Override public void run ( ) { super . run ( ) ; try { ServerSocket serverSocket = new ServerSocket ( 6666 ) ; Socket pingSocket = null ; BufferedWriter buf = null ; while ( mRun ) { pingSocket = serverSocket . accept ( ) ; buf = new BufferedWriter ( new OutputStreamWriter ( pingSocket . getOutputStream ( ) ) ) ; buf . write ( "ACK\n" ) ; buf . flush ( ) ; buf . close ( ) ; pingSocket . close ( ) ; } serverSocket . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
keep running the ping receiver while mRun is true
keep running the ping receiver while mRun is true
// listening on port 6666 for ELB pings // returning ACK to the ELB although this is not needed... // in case of an exception the ping receiver will stop