Return-Path: william@bourbon.usc.edu Delivery-Date: Sun Oct 5 20:25:20 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 m963PKwM015500 for ; Sun, 5 Oct 2008 20:25:20 -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 m963V08E010265 for ; Sun, 5 Oct 2008 20:31:00 -0700 Message-Id: <200810060331.m963V08E010265@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: CS551: Final Project : recv() Date: Sun, 05 Oct 2008 20:31:00 -0700 From: Bill Cheng Someone wrote: > We had a question, > > Assume that a thread is in recv() state (hence blocked until somebody writes > into its receive buffer) , is there any way in which we can break out of > this recv() block without anybody writing into the receive buffer ? You should use select() to make sure that there is data to be read before you call recv(). You should use a timeout value of, say 100ms, with select(). -- Bill Cheng // bill.cheng@usc.edu