Return-Path: william@bourbon.usc.edu Delivery-Date: Sun Oct 5 20:34:26 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 m963YQ1g015580 for ; Sun, 5 Oct 2008 20:34:26 -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 m963e79L010362 for ; Sun, 5 Oct 2008 20:40:07 -0700 Message-Id: <200810060340.m963e79L010362@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: Regarding fields in message header and format Date: Sun, 05 Oct 2008 20:40:06 -0700 From: Bill Cheng Someone wrote: > I had a question about the message headers and formats. > Should we keep all the fields in the message header and the message format > (for eg in HELLO message) as "char". > > for eg. in HELLO msg. I define the structure as > struct hello > { > char port_number[2]; > char *hostname; > } > > This is because we will be running on different OS. Datatypes other than > char would differ depending on the OS. Isn't it correct? As I've suggested during lecture 2, I would keep my data in data structures in forms easier for me to manipulate. When trying to send data, I would use a character buffer, copy data from my data structure into this character buffer, then call write() to send data out. Right before I call write() or send(), I can use the debugger to check every byte to see if what I'm sending is correct. -- Bill Cheng // bill.cheng@usc.edu