OK, problem exists between chair & keyboard. My main loop was badly behaved. I stripped it back to the most basic stdin read loop and it terminates ok. Time to start building it up again and see where it fails.
For reference, here’s a minimal Java program that works nicely over ports, terminating when the process or BEAM terminates (including brutally killing from Windows task manager):
package com.thing;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
int ch;
while(true) {
ch = System.in.read();
if (ch == -1) {break;} // This is the EOF signal in Java
if (ch == 'q') {break;}
if (ch == 't') {System.out.println("tasks");}
System.out.println(" got " + ch + " - " + (char)ch);
}
}
}






















