Return-Path: william@bourbon.usc.edu Delivery-Date: Wed Sep 10 08:07:33 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 m8AF7Xlx022779 for ; Wed, 10 Sep 2008 08:07:33 -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 m8AF72R7014416 for ; Wed, 10 Sep 2008 08:07:02 -0700 Message-Id: <200809101507.m8AF72R7014416@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: 551 warmup-1 Date: Wed, 10 Sep 2008 08:07:02 -0700 From: Bill Cheng Someone wrote: > In my server side code, if I define the socket descriptor variable as a > global variable then my accept fails with "Bad file number". It works > normally if it is a local variable > What might be the reason for this? > > int mySocket; > > main() { > .. > .. > accept() // fails > > } Sounds strange! I have no idea why it's this way. I think it's just a silly bug that you need to find in your code. -- Bill Cheng // bill.cheng@usc.edu