Return-Path: william@bourbon.usc.edu Delivery-Date: Mon Oct 6 08:59:34 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 m96FxYZ6023926 for ; Mon, 6 Oct 2008 08:59:34 -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 m96G5MXb022236 for ; Mon, 6 Oct 2008 09:05:22 -0700 Message-Id: <200810061605.m96G5MXb022236@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: CS551 : Final project 1 Date: Mon, 06 Oct 2008 09:05:22 -0700 From: Bill Cheng I forgot to mention... This thread also acts as the network-write thread in slide 19 of lecture 9. Therefore, it needs to check its input queue to see if there is work to do, i.e., data to send. -- Bill Cheng // bill.cheng@usc.edu -----Original Message----- Date: Mon, 06 Oct 2008 08:42:21 -0700 From: Bill Cheng To: cs551@merlot.usc.edu Subject: Re: CS551 : Final project 1 Someone wrote: > After the startup, every node will send hello to > every neighbor node. What the node (the client part) will do after the > startup?? Should it close the connection and exit the client thread?? > If it close the connection then should it has to send notify message. > > Hello should be sent at the start up time or before initiating a data > transfer?? > > If we have keepalive message then why we need hello? If you look at slide 14 of lecture 9, when you see that there is a line drawn between two nodes, it means that there is an *active* connection between the two nodes. If you close a connection, the link will be gone. On slide 19 of lecture 9, I have shown a design (just a design and not "the" design) where two threads are used per socket. It's perfectly fine to use one thread per socket, like you are suggesting above. What does such a thread do? Well, this is a network. The main job for a node in the network is to *forward* packets. So, a thread would just wait for a packet to arrive, decrement its TTL, and decide what to do with the packet. If you decide to bring down an active connection, you should always send NOTIFY before you shutdown and close the socket. -- Bill Cheng // bill.cheng@usc.edu