Return-Path: william@bourbon.usc.edu Delivery-Date: Sun Oct 5 08:05: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.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 m95F5qBg008613 for ; Sun, 5 Oct 2008 08:05:52 -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 m95FBP0C000954 for ; Sun, 5 Oct 2008 08:11:25 -0700 Message-Id: <200810051511.m95FBP0C000954@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: Regarding connection establishment Date: Sun, 05 Oct 2008 08:11:25 -0700 From: Bill Cheng Someone wrote: > When a beacon node starts up, it first tries to establish a connection > with each of the other beacon nodes. So we should create one socket > descriptor for each connection right ? Correct. > Something like an array of sockfds ? Try not to use arrays! In warmup #2, you needed to implement Q1. I was hoping that you implementated it using a list of some sort. For the final project, you need queues like this all over the place. I'm hoping that you will use lists for all these. Then you can use the same list to keep track of all your connections (with beacon or non-beacon nodes). When a non-beacon node decides that one of the beacon nodes is its neighbor, it will also make a connection to one of your beacon nodes. Of course, you can use an array to implement a queue if you call realloc(). Please just make sure that you don't use a fixed size array! -- Bill Cheng // bill.cheng@usc.edu