use of com.cisco.trex.stateless.model.capture.CapturedPkt in project trex-stateless-gui by cisco-system-traffic-generator.
the class RecordController method handleSavePkts.
public void handleSavePkts(int monitorId) {
List<CapturedPkt> capturedPkts = new ArrayList<>();
int pendingPkts = 1;
while (pendingPkts > 0) {
try {
CapturedPackets capturedPackets = pktCaptureService.fetchCapturedPkts(monitorId, 1000);
pendingPkts = capturedPackets.getPendingPkts();
capturedPkts.addAll(capturedPackets.getPkts());
} catch (PktCaptureServiceException e) {
LOG.error("Unable to fetch packets.", e);
break;
}
}
File outFile = fileChooser.showSaveDialog(getScene().getWindow());
if (outFile != null) {
try {
dumpPkts(capturedPkts, outFile.getAbsolutePath());
} catch (Exception e) {
LOG.error("Unable to dump packets.", e);
}
}
}
Aggregations