Return-Path: william@bourbon.usc.edu Delivery-Date: Mon Sep 8 23:16: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 m896GYQ4032391 for ; Mon, 8 Sep 2008 23:16: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 m896FhmM017097 for ; Mon, 8 Sep 2008 23:15:43 -0700 Message-Id: <200809090615.m896FhmM017097@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: Port numbers Date: Mon, 08 Sep 2008 23:15:43 -0700 From: Bill Cheng Someone wrote: > Its mentioned ( as an example) that if we enter the port # 80, the server > should quit. > > Do we also check if the port numbers are in the range assigned to us, in > which case we will consider any other port number to be invalid ? Please don't do that! May be some day someone will run your code as root and it should work. > Or will any well-known port number be valid ? You should call bind(). If it fails, just print an error message and quit. It shouldn't matter why bind() fails. -- Bill Cheng // bill.cheng@usc.edu