Return-Path: william@bourbon.usc.edu Delivery-Date: Fri Sep 5 08:31:47 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 m85FVlLA006165 for ; Fri, 5 Sep 2008 08:31:47 -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 m85FU4Tk030248 for ; Fri, 5 Sep 2008 08:30:04 -0700 Message-Id: <200809051530.m85FU4Tk030248@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: CS-551 warmup-1 Date: Fri, 05 Sep 2008 08:30:04 -0700 From: Bill Cheng Someone wrote: > One of the args to client is hostname:port. I know how to open a socket when > they are separate strings, but is there a way to do it that would not > require parsing the string (in other words that would set up the socket > based on hostname:port). You need to parse the string! It shouldn't be too bad. You can use strchr() to look for the ':' character. If you find it, you can replace it by a '\0' and move the string pointer down by 1 character position. Then you have a string pointer for the hostname and a string pointer for the port number. -- Bill Cheng // bill.cheng@usc.edu