Return-Path: william@bourbon.usc.edu Delivery-Date: Mon Nov 24 22:06:52 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 mAP66q75007476 for ; Mon, 24 Nov 2008 22:06:52 -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 mAP65PHg001540 for ; Mon, 24 Nov 2008 22:05:25 -0800 Message-Id: <200811250605.mAP65PHg001540@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: Select from stdin Date: Mon, 24 Nov 2008 22:05:25 -0800 From: Bill Cheng Someone wrote: > I was facing a somewhat similar problem a couple of days back. This might > help. > > I made a variable true and forgot to make it false while looping. Something > like the following: > > if(message type is STOR) { > ....bigData = true) > } > > if(bigData is false) { > ....recv data into buffer > } > else { > ....recv byte by byte > //FORGOT TO MAKE IT FALSE > } Certainly, that's one out of many possible bugs. -- Bill Cheng // bill.cheng@usc.edu On Mon, Nov 24, 2008 at 9:15 PM, Bill Cheng wrote: > Someone wrote: > > > To read the commands from the user we are using select as follows: > > > > select(1,&readfds, NULL,NULL,NULL); > > > > This never gave us any problems earlier. Even now it works perfectly for > all > > the commands except for a "search keywords " command. In this case, it > does > > what "search keywords" asks it to do and then from there, it is not able > to > > detect ANY commands. > > Sounds like a bug somewhere. > > > We did a printf before the select and determined that it is blocking on > > select() and not detecting any sort of input commands after that "search > > keywords" operation is done. We have been trying to debug this for quite > > some time and are unable to come up with any solution. Could you please > help > > us regarding this ? Any hints or ideas on what could be causing this > problem > > ? > > If "search keywords" is the only command that breaks things, > my guess is that it's the usual memory corruption bug and > somehow it affects you reading from stdin. > > I don't have any great idea in how to find the bug. Sorry. > -- > Bill Cheng // bill.cheng@usc.edu