Return-Path: william@bourbon.usc.edu Delivery-Date: Sun Nov 16 11:14:48 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.4 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 mAGJEln6025216 for ; Sun, 16 Nov 2008 11:14:48 -0800 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id mAGJB4Lm012760 for ; Sun, 16 Nov 2008 11:11:04 -0800 Message-Id: <200811161911.mAGJB4Lm012760@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: Misunderstanding TCP stream? Date: Sun, 16 Nov 2008 11:11:04 -0800 From: Bill Cheng Someone wrote: > If we receive a search request and there are no hits do we need to respond > with a search response? If so do we just put 0 in the lengt field? That would be fine, but the right thing to do is not to generate a search response. For a network like this, it is expected that most of the messages in the network will be search related. So, you should not send unnecessary search related messages. -- Bill Cheng // bill.cheng@usc.edu -----Original Message----- From: Bill Cheng [mailto:william@bourbon.usc.edu] Sent: Saturday, November 15, 2008 7:35 AM To: cs551@merlot.usc.edu Subject: Re: Misunderstanding TCP stream? Someone wrote: > Due to the buffer size constraints, I first send the message common header > and metadata. I then iteratively read in 'chunks' of the file data, and send > each 'chunk' individually. The common header of course tells the client how > much data to expect, including the file data. > > When I attempt this though, for some reason, the client reads in the correct > number of bytes, but the file data bytes are incorrect. And then a few > seconds later the client seg faults. Am I misunderstanding / misusing the > TCP stream? I thought this should work? Sounds like you are doing it correctly. This is also what we did for warmup #1 (except that instead of reading and writing one block at a time, we were reading and writing one byte at a time). If your warmup #1 is working properly, you can change it to do it the same way you are doing and you should see that it works. So, my guess is that the bug is somewhere else. -- Bill Cheng // bill.cheng@usc.edu