long encStart = 0;
long encEnd = 0;
int totalBytes = 0;
long totalMillis = 0;
ClientHttpRequest chr;
try {
// Open a connection to the web server and create a request that has
// the room and event type.
System.out.println(getTimeStamp() + " Http[" + id + "] Open connection. In sendBlockData");
openConnection();
chr = new ClientHttpRequest(conn);
chr.setParameter(ROOM, room);
chr.setParameter(EVENT, CaptureEvents.CAPTURE_UPDATE.getEvent());
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// For each changed block, append an uploaded-file entry to the form data.
// The file name contains the block info. The file name has this format:
// "blockgroup_<seqnum>_<position>". The original filename is just set to
// "block<i>".
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
for (int i = 0; i < changedBlocks.length; i++)
{ // append each changed-block to the form
EncodedBlockData block = retriever.getBlockToSend((Integer) changedBlocks[i]);
String changed_blocks_upload_filename =
BLOCKGROUP + "_" + seqNumGenerator.getNext() + "_" + block.getPosition();
chr.setParameter(changed_blocks_upload_filename, "block"+i, new ByteArrayInputStream(block.getVideoData()));
} // append each changed-block to the form
// Post the multi-part form to the server
chr.post();
HttpURLConnection httpConnection = (HttpURLConnection) chr.connection;
int status = httpConnection.getResponseCode();
System.out.println("******* POST status = [" + status + "] ***************");