data = "/?!\r\n";
writeTrace("<- " + now() + "\t"
+ GXCommon.bytesToHex(data.getBytes("ASCII")));
media.send(data, null);
if (!media.receive(p)) {
throw new Exception("Invalid meter type.");
}
While sending the IEC identification request ("/?!\r\n"), the application fails to receive a valid response from the meter. As a result, the media.receive(p) call returns false, and the process throws an "Invalid meter type." exception.