private void invokeSDC() {
try {
List listRequest = readFile(_file);
for (Iterator iterator = listRequest.iterator(); iterator.hasNext();) {
final InetSocketAddress address = new InetSocketAddress(_host, _port);
final CGISocket protocol = new CGISocket(address, CONNECT_TIMEOUT);
protocol.setTimeout(CONNECT_TIMEOUT);
String response = "";
try {
Timer timer = new Timer();
timer.start();
// write message request to server
String request = (String) iterator.next();
if (request != null) _logger.info(timer.ellapsed(), "[SENT] {" + request + "}");
protocol.write(request);
// read message response from server
response = protocol.read();
if (response != null) _logger.info(timer.ellapsed(), "[RCVD] {" + response + "}");
} finally {
protocol.close();
}
}
} catch (IOException e) {
e.printStackTrace();
}