Return-Path: william@bourbon.usc.edu Delivery-Date: Tue Sep 9 20:36:29 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id m8A3aTEL015092 for ; Tue, 9 Sep 2008 20:36:29 -0700 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id m8A3Zp8c006245 for ; Tue, 9 Sep 2008 20:35:51 -0700 Message-Id: <200809100335.m8A3Zp8c006245@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: DOUBT with filesize response Date: Tue, 09 Sep 2008 20:35:51 -0700 From: Bill Cheng Hi, I cannot look at details of so much code! Let's say that the file size is 13579 bytes. What would be the value of your serverResponseFsz.dataLen? (I hope it's 5.) -- Bill Cheng // bill.cheng@usc.edu -----Original Message----- Date: Tue, 09 Sep 2008 16:53:43 -0700 From: Kamal Ramchandani To: chengw@usc.edu Subject: DOUBT with filesize response i am facing a problem with filesize.........the request reaches the server from client and the server successfully calculates the size of the file.........the problem i am facing is with sending that back to the client.......... char sv_fsz_resp_buf[512]; // i was using malloc but just for the timebeing i am using this memcpy(sv_fsz_resp_buf, &serverResponseFsz.msgType, 2); memcpy(&sv_fsz_resp_buf[2], &serverResponseFsz.offset, 4); memcpy(&sv_fsz_resp_buf[6], &serverResponseFsz.dataLen, 4); memcpy(&sv_fsz_resp_buf[10], serverResponseFsz.data, serverResponseFsz.dataLen); cout << (serverResponseFsz.dataLen + 10) << endl ; for(int iCount6 = 0; iCount6 < (serverResponseFsz.dataLen + 10) ; iCount6 ++) { if (send(new_fd, &sv_fsz_resp_buf[iCount6], 1, 0) == -1) // Send the packet { cout << "Error in send" << endl; } cout << "iCount6 = " << iCount6 << endl; } the problem is that the for loop runs just 2 times the value of iCount6 goes till 1 and the loop terminates..... the value of (serverResponseFsz.dataLen + 10) is however 13............i dnt knw why the loop is being terminated........ if you could please help............have spent an entire day in figuring this out..........