Return-Path: lccheung@usc.edu Delivery-Date: Sun Oct 28 18:56:37 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx0.usc.edu (msg-mx0.usc.edu [128.125.137.5]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l9T1uaEt032620 for ; Sun, 28 Oct 2007 18:56:36 -0700 Received: from [204.57.0.20] by msg-mx0.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JQN00HNEH3HLW10@msg-mx0.usc.edu> for cs551@merlot.usc.edu; Sun, 28 Oct 2007 18:50:05 -0700 (PDT) Date: Sun, 28 Oct 2007 18:50:52 -0700 From: Leslie Cheung Subject: office hour, Oct 29 Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <47253C7C.8010704@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Hi class, I will move my office hour tomorrow (Oct 29) to 3:30pm - 4:30pm. Sorry for any inconvenience. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Mon Oct 8 13:29:51 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l98KToi9029491 for ; Mon, 8 Oct 2007 13:29:50 -0700 Received: from smtp103.sbc.mail.mud.yahoo.com ([68.142.198.202]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JPM00KZ00PI4050@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Mon, 08 Oct 2007 13:24:57 -0700 (PDT) Received: (qmail 92334 invoked from network); Mon, 08 Oct 2007 20:24:54 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.147.135 with login) by smtp103.sbc.mail.mud.yahoo.com with SMTP; Mon, 08 Oct 2007 20:24:53 +0000 Date: Mon, 08 Oct 2007 13:23:00 -0700 From: Leslie Cheung Subject: office hour To: cs551@merlot.usc.edu Message-id: <0JPM00KZ10PI4050@msg-mx1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: AcgJ6QVlDqsD0D5cRx2wz+WICxo9Cg== X-YMail-OSG: EVsSIJMVM1mErvdsTqCet8_3mZmbPUmLNt3lqsK1hmr4kCYZ Hi class, I have to move my office hour today to Wed (Oct 10). So on Wed, I'll hold office hour from 2-4pm. Sorry for the late notice! Regards, Leslie Return-Path: lccheung@usc.edu Delivery-Date: Mon Sep 17 11:03:43 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8HI3hhB007153 for ; Mon, 17 Sep 2007 11:03:43 -0700 Received: from smtp103.sbc.mail.mud.yahoo.com ([68.142.198.202]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOI005TJY10E340@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Mon, 17 Sep 2007 11:00:43 -0700 (PDT) Received: (qmail 89802 invoked from network); Mon, 17 Sep 2007 18:00:36 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp103.sbc.mail.mud.yahoo.com with SMTP; Mon, 17 Sep 2007 18:00:35 +0000 Date: Mon, 17 Sep 2007 10:59:39 -0700 From: Leslie Cheung Subject: office hour To: cs551@merlot.usc.edu Message-id: <0JOI005TKY10E340@msg-mx1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf5VIP4K3QKxczfTPGS+v7oQrZEhg== X-YMail-OSG: 1hyRSEEVM1kj.496XBONfCSMfliiWMRnqZ6eNj2a_q7ytF1J Hi all, I am moving my office hour today to Wed (this week only). So I will hold office hour from 2-4pm on Wed (Sep 19). Sorry for the inconvenience. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Sep 16 16:44:15 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8GNiFlZ009279 for ; Sun, 16 Sep 2007 16:44:15 -0700 Received: from smtp110.sbc.mail.mud.yahoo.com ([68.142.198.209]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with SMTP id <0JOH00G8YJ4U0PE1@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Sun, 16 Sep 2007 16:41:18 -0700 (PDT) Received: (qmail 91173 invoked from network); Sun, 16 Sep 2007 23:41:18 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp110.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 23:41:17 +0000 Date: Sun, 16 Sep 2007 16:40:30 -0700 From: Leslie Cheung Subject: RE: Malicious client In-reply-to: <46EDADC8.1030306@usc.edu> To: cs551@merlot.usc.edu Message-id: <0JOH00G8ZJ4U0PE1@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4sN9wGMmOKJL9SqaMRveOC38AOQACbVlg X-YMail-OSG: p.X4_B8VM1mDgTuvGjPPiREmv1PIuohX1u6iwZzAPb_5o.3_ Someone wrote: > I am using pthreads and a global list for join. During > "Failing Kill" test in grading guidelines, when I press CTRL+C on > server, it takes about 4-5 seconds(and not just 2 seconds) to exit > because of the overhead of reading the list, joining, and killing all > the threads and then shutdown. Is there any way I can reduce this time > to 2 seconds as mentioned in the grading guild lines? You need to figure out where the overhead comes in. I suspect that it's taking so long because your threads are blocked on read(), and you wait until an alarm has expired before you can terminate the threads. My suggestion is to try sending signals to these threads, so as soon as the user has pressed Ctrl-C, the threads know right away. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Sep 16 16:17:32 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8GNHWcB007745 for ; Sun, 16 Sep 2007 16:17:32 -0700 Received: from smtp102.sbc.mail.mud.yahoo.com ([68.142.198.201]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOH00DB5HW94W20@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Sun, 16 Sep 2007 16:14:33 -0700 (PDT) Received: (qmail 89047 invoked from network); Sun, 16 Sep 2007 23:14:34 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp102.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 23:14:34 +0000 Date: Sun, 16 Sep 2007 16:13:47 -0700 From: Leslie Cheung Subject: RE: grading guidelines In-reply-to: <46ED678F.4060308@usc.edu> To: cs551@merlot.usc.edu Message-id: <0JOH00DB6HW94W20@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4hvrGfuWslf0pSEScfrRqPUqofAAMAx8g X-YMail-OSG: v7Ne3hEVM1k2iJDmf6CtL7wRfwz3VDhUT3AJl.qDAYl.y1.L Someone wrote: > Missing README file : -5 points (if lots of comments in code) > (Document+this cannot go negative) > > > Could you please elaborate on "if lots of comments in code" portion of the spec ? > Documentation in warmup1 worth 10 points. If you don't have a README file, the max you can get for documentation is 5 points, provided that you have a lot of comments in your code. If you have little comments in your code and you don't have a README file, you stand to lose up to 10 points. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Sep 16 00:36:30 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_05 autolearn=no version=3.2.0 Received: from msg-mx7.usc.edu (msg-mx7.usc.edu [128.125.137.25]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G7aUIY021553 for ; Sun, 16 Sep 2007 00:36:30 -0700 Received: from smtp103.sbc.mail.mud.yahoo.com ([68.142.198.202]) by msg-mx7.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG000UOAC0W410@msg-mx7.usc.edu> for cs551@merlot.usc.edu; Sun, 16 Sep 2007 00:33:37 -0700 (PDT) Received: (qmail 10200 invoked from network); Sun, 16 Sep 2007 07:33:36 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp103.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 07:33:36 +0000 Date: Sun, 16 Sep 2007 00:32:51 -0700 From: Leslie Cheung Subject: RE: Few doubts regarding Warmup1 In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOG000UPAC0W410@msg-mx7.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4JV9RmqqSpywOQRe8bbC1RaTVKwABRr8w X-YMail-OSG: 2qs6LTIVM1lLx4QROBXtGW1lh2t.g3Y73s76WtWbfrmtdCv8 Someone wrote: > I have few doubts as follows: > > 1> In Malicious client 3: > My Server tries to send a message to the client but because the client has > closed it just hangs for a while and then quits when the timeout occurs. Is this > behavior okay? > Or is my server expected to display an error message when client > closes a socket. If so, could you please suggest how we can know if the socket on > the other end is closed while sending the data? I couldnt find any return code of > send() function specific to that. > > 2> In Malicious client 3: > Client exits saying "No data to read" and my server quits only after the > autoshutdown timeout. No special error message is displayed on a server side. Is it > okay? For both Q1 and Q2, please read Bill's message with timestamp "Tue 11 Sep 19:19 ". > 3> Malicious ServerS #3 and #4 > Client works fine but takes a lot of time to display the results. As of now my client > NEVER times out. Is it okay? Or the client should time out too? You should do the best you can to handle it. > 4> What should be the behavior when Cntrl+c is hit on the client side. At this point I > am not handling it explicitly in client. The server tries to send the data and eventually > times out. No special error message is displayed on a server side. Is it okay? In the spec we said you should shutdown gracefully. I think this applies when Ctrl-C is pressed on a client: if it's in the middle of a long transfer, you should close any opened socket and clean up. > 5> I tried searching about non-blocking sockets on the net. Could you please tell me > how do I make sure that I am NOT using these? I mean I don't' think I am using > non-blocking sockets.But I do not know how to be sure about this. If you are not doing anything special (e.g., setting socket options), you should be ok. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Sep 16 00:26:17 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx8.usc.edu (msg-mx8.usc.edu [128.125.137.26]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G7QGGe020982 for ; Sun, 16 Sep 2007 00:26:16 -0700 Received: from smtp107.sbc.mail.mud.yahoo.com ([68.142.198.206]) by msg-mx8.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG00MQ19UZF6G1@msg-mx8.usc.edu> for cs551@merlot.usc.edu; Sun, 16 Sep 2007 00:23:23 -0700 (PDT) Received: (qmail 62701 invoked from network); Sun, 16 Sep 2007 06:56:42 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp107.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:56:42 +0000 Date: Sat, 15 Sep 2007 23:55:57 -0700 From: Leslie Cheung Subject: RE: bad port In-reply-to: <42b5eb970709152234w56ce28dfx941c2b568986a12@mail.gmail.com> To: cs551@merlot.usc.edu Message-id: <0JOG00MQ29UZF6G1@msg-mx8.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4JDLpO5Zz/GsdS76n0zFZhoZZkAABkWzQ X-YMail-OSG: dBWI4eMVM1mgVK5RCm2jsdlnfzh1b6ovO8qPPY8gHBQUDOJz Someone wrote: > but i have limited the use of ports to above 1024 only > is that correct? You *don't need to* do anything special. Since you don't have root access, so some system calls will give you an error. --Leslie > On 9/15/07, Leslie Cheung wrote: > > Someone wrote: > > > > > Then how do we pass the following test from the grading guidelines? > > > > > > ./server 80 > > > (bad port, the server should quit) > > > > Please see Bill's message with timestamp "Sun 09 Sep 18:40". > > > > --Leslie > > > > > > > On 9/15/07, Leslie Cheung wrote: > > > > Someone wrote: > > > > > > > > > Should I limit the port which can be used > > > > > to just those ports assigned to me? > > > > > > > > No! Please do not do anything to limit the range of port numbers you can > > > > use. When we grade we use different ports. > > > > > > > > --Leslie > > > > > > > > > > > > > > > > > > Return-Path: lccheung@usc.edu Delivery-Date: Sun Sep 16 00:21:33 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_05 autolearn=no version=3.2.0 Received: from msg-mx10.usc.edu (msg-mx10.usc.edu [128.125.137.28]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G7LX4Z020666 for ; Sun, 16 Sep 2007 00:21:33 -0700 Received: from smtp114.sbc.mail.mud.yahoo.com ([68.142.198.213]) by msg-mx10.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG0066R9N4VI50@msg-mx10.usc.edu> for cs551@merlot.usc.edu; Sun, 16 Sep 2007 00:18:40 -0700 (PDT) Received: (qmail 67083 invoked from network); Sun, 16 Sep 2007 06:51:59 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp114.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:51:59 +0000 Date: Sat, 15 Sep 2007 23:51:14 -0700 From: Leslie Cheung Subject: RE: CS551 Malicious Server Test In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOG0066S9N4VI50@msg-mx10.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4I8z8w1WIHzjdS1yTNccKhs2tlQABqnag X-YMail-OSG: ZaLiidIVM1ktMfiO1UKJm_4hOXhNtD1GvCNu095s9SyvmWeu0gQ3QBz7YFGP4rU8Z_I7MIAPo8oIeBWkQBYvS_QkJ4nnIpz4fmFn Someone wrote: > I have a question regarding Malicious server test #2: > Test client against malicious server #2 (there is no #1): -3 points > (the following server will send a very long reply, > the client should print out what's in the reply) > ~csci551b/public/warmup1/wserver -2 $port > ./client -a localhost:$port www.cs.usc.edu > >Shouldn't we code our client to NOT print out the very long reply since the server is >malicious? It seems to me the result for this test should be to notify the client user >that the server sent back a response in error. The test has the server doing a DNS > lookup(-a), so for an IPv4 (assumed for this project) address that will never exceed > 15 bytes. To me, printing the entire message on a DNS > lookup request would be failing the test, not passing. We expect you handle this reasonably. I think it's ok to say something like "the reply is too long". As long as you handle it reasonably, that's ok. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Sep 16 00:15:47 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx9.usc.edu (msg-mx9.usc.edu [128.125.137.27]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G7Fl8Y020332 for ; Sun, 16 Sep 2007 00:15:47 -0700 Received: from smtp111.sbc.mail.mud.yahoo.com ([68.142.198.210]) by msg-mx9.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG00M0Q9DHQWB0@msg-mx9.usc.edu> for cs551@merlot.usc.edu; Sun, 16 Sep 2007 00:12:54 -0700 (PDT) Received: (qmail 7762 invoked from network); Sun, 16 Sep 2007 07:12:53 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp111.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 07:12:52 +0000 Date: Sun, 16 Sep 2007 00:12:07 -0700 From: Leslie Cheung Subject: RE: detecting that socket is closed at server side In-reply-to: <42b5eb970709152258s41b7bac3wafc27e5ab69b6695@mail.gmail.com> To: cs551@merlot.usc.edu Message-id: <0JOG00M0R9DHQWB0@msg-mx9.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4JpQReBBMspXZQ56dFB3ijIil/AAA+fmA X-YMail-OSG: D4qsMQQVM1kyBqhYSxBoGywAKAPvRFJZRp6zL1e9iwP.OVuD Someone wrote: > when i shutdown during file transfer, the server shuts down, but the > client side keeps receiving bytes... > in the handler function for SIGALRM, i have sent a kill command to the child, > and i have handled the kill command in the child -> the handler fro > which closes the sockets and exits. > > but in spite of this, i keep receiving bytes at the client side? > i am not able to figure out what the problem is. I can't tell. It looks like a child process is still running after you have shut down your server. It's possible that the client can still read for a short while after the server has shut down. But if after a few seconds since the server has shut down, the client can still read data, something is not right. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Sep 16 00:01:58 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx7.usc.edu (msg-mx7.usc.edu [128.125.137.25]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G71vHM019598 for ; Sun, 16 Sep 2007 00:01:58 -0700 Received: from smtp105.sbc.mail.mud.yahoo.com ([68.142.198.204]) by msg-mx7.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG00L5H8QGGD70@msg-mx7.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 23:59:04 -0700 (PDT) Received: (qmail 95921 invoked from network); Sun, 16 Sep 2007 06:59:04 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp105.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:59:04 +0000 Date: Sat, 15 Sep 2007 23:58:19 -0700 From: Leslie Cheung Subject: RE: how to link openssl library In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOG00L5I8QGGD70@msg-mx7.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4Lc/8nPmXohtnRf2pjLyFPYhhEAAAFAYA X-YMail-OSG: 0cHnTYoVM1nrGDN.1BiuHrFnHNWXN8HJyFNJtoNNYUxsY.Qm Someone wrote: > I have found the openssl installtion at: > /usr/lsd/openssl/0.9.7l/include > > I am trying to link to the library using the following directive in makefile: > -l/usr/lsd/openssl/0.9.7l/lib/libssl.so.0.9.7 > > I keep getting the following error: > -l/usr/lsd/openssl/0.9.7l/lib/libssl.so.0.9.7 (this file does exist inthe mentioned > directory above) > > I have also tried: > -l/usr/lsd/openssl/0.9.7l/lib/libssl.a > > I get the same error. > > I have been at this for a while, please help. Please read the "additional notes on openssl" in the project spec. The first thing that comes to my mind is that you are using the wrong version of openssl. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 23:50:10 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G6oAhI019065 for ; Sat, 15 Sep 2007 23:50:10 -0700 Received: from smtp108.sbc.mail.mud.yahoo.com ([68.142.198.207]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG004AL86S3U20@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 23:47:17 -0700 (PDT) Received: (qmail 70423 invoked from network); Sun, 16 Sep 2007 06:47:16 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp108.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:47:16 +0000 Date: Sat, 15 Sep 2007 23:46:31 -0700 From: Leslie Cheung Subject: RE: Broken pipe In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOG004AM86S3U20@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4GA6HvRKFQLRAQ+i1o1hmUtAPuAAAm+Pg X-YMail-OSG: VCEcfW0VM1mUKvEfhfMby0Gx.EF.qJvQqjcZjw9Sqbffi1N7 Someone wrote: > I checked the return value of recv(), but still get the error: Broken pipe. > > Could you suggest me a way to fix this? One way to do it is to catch the signal SIGPIPE using a signal handler. But you should make sure you are not reading/writing to a closed socket. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 23:49:30 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G6nU5r018933 for ; Sat, 15 Sep 2007 23:49:30 -0700 Received: from smtp114.sbc.mail.mud.yahoo.com ([68.142.198.213]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG0042A85O3Y30@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 23:46:37 -0700 (PDT) Received: (qmail 58447 invoked from network); Sun, 16 Sep 2007 06:39:55 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp114.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:39:55 +0000 Date: Sat, 15 Sep 2007 23:39:10 -0700 From: Leslie Cheung Subject: RE: RE: Malicious client In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOG0042B85O3Y30@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4D/kO9K6/DbZORp2OEbXscqaw3gACn+Pw X-YMail-OSG: eV8i7wYVM1lN5TsB.QmiV4U1jo9GZ8IYTGMK0qTJfS1YazAf Someone wrote: > I am getting the follwing responses for malicious clients. Please tell me if they are > correct.. > > 1. No data read > 2. No data read > 3. This malicious client exits intentionally > 4. No data read > 5. Normal response Please do not ask this kind of question. Dr Cheng and I have stressed several times, that you shouldn't be asking "is this ok" or "is this correct" kind of questions. You have to decide if you are doing it correctly, based on the spec and what we tell you about the malicious client/server. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 23:47:01 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=AWL,BAYES_50,SUBJ_ALL_CAPS autolearn=no version=3.2.0 Received: from msg-mx9.usc.edu (msg-mx9.usc.edu [128.125.137.27]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G6l1Ks018810 for ; Sat, 15 Sep 2007 23:47:01 -0700 Received: from smtp107.sbc.mail.mud.yahoo.com ([68.142.198.206]) by msg-mx9.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG0005M81KKZ30@msg-mx9.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 23:44:08 -0700 (PDT) Received: (qmail 57742 invoked from network); Sun, 16 Sep 2007 06:44:08 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp107.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:44:07 +0000 Date: Sat, 15 Sep 2007 23:43:22 -0700 From: Leslie Cheung Subject: RE: ALL_FAIL In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOG0005O81KKZ30@msg-mx9.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4FVBigWDN46KTRBGFt1VPI11DhgABSvbg X-YMail-OSG: 9APNQFQVM1kbZZMKXkjYKZRyl5Pq9dnaQLQcOcZGCGqYypRT Someone wrote: > If the client get ALL_FAIL > > what should be put on the screen? Just output something reasonable. So that you notify the user something is going wrong. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 23:45:29 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G6jTJQ018688 for ; Sat, 15 Sep 2007 23:45:29 -0700 Received: from smtp108.sbc.mail.mud.yahoo.com ([68.142.198.207]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG00D727Z079F0@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 23:42:36 -0700 (PDT) Received: (qmail 66785 invoked from network); Sun, 16 Sep 2007 06:42:36 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp108.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:42:35 +0000 Date: Sat, 15 Sep 2007 23:41:50 -0700 From: Leslie Cheung Subject: RE: warmup #1 In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOG00D747Z079F0@msg-mx1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4EbW0LLSlDnG4T/uBQ06RGO0lqwACMTSw X-YMail-OSG: 2cG6hj4VM1mDd6id7La30l2na7GlWaDR3CcyotLRF68IiFi. Someone wrote: > To get filesize I am using this snippet.But only for /etc/shadow it gives me error in > opening file on server > if(stat(ipbuf, &fs) == -1) > { > printf("\tError in opening file\n"); > > for all other files I am getting right filesize. Can you tell me whether my output is right > or wrong? If you can get the size of this file by calling "ls", your code should be able to get it. > does it has to do anything with the permission. You do not have read permission to this file, but you have permission to look at its metadata (e.g., file size). > Because when I try to > open the file using emacs then it opens a blank file with the message "read > permission denied" Because you don't have read permission. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 23:41:25 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx10.usc.edu (msg-mx10.usc.edu [128.125.137.28]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G6fP6w018467 for ; Sat, 15 Sep 2007 23:41:25 -0700 Received: from smtp105.sbc.mail.mud.yahoo.com ([68.142.198.204]) by msg-mx10.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG0060K7S8VN10@msg-mx10.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 23:38:32 -0700 (PDT) Received: (qmail 78068 invoked from network); Sun, 16 Sep 2007 06:38:32 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp105.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:38:31 +0000 Date: Sat, 15 Sep 2007 23:37:46 -0700 From: Leslie Cheung Subject: RE: MD5 of file which 0 bytes in size In-reply-to: <46EC9F33.9050409@usc.edu> To: cs551@merlot.usc.edu Message-id: <0JOG0060L7S8VN10@msg-mx10.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4D4hnBhaN51LhSYajFfmro7dLiQACuzHw X-YMail-OSG: umCy9k4VM1n2PflW_c2pZEGKkddiJcY3_KQl3p9Y3m6hu6Yv Someone wrote: > If a client sends request for file "asd" which is 0 bytes in size > > What should be server's reply, I belive it should be GETRPLY with data > length field as 0. I think so. > What should client do in that case. How can it calculate the MD5 of 0 > bytes file. You can still get a MD5 checksum for a 0 bytes file by calling the appropriate MD5-related functions. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 23:33:09 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx10.usc.edu (msg-mx10.usc.edu [128.125.137.28]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G6X9FA018035 for ; Sat, 15 Sep 2007 23:33:09 -0700 Received: from smtp102.sbc.mail.mud.yahoo.com ([68.142.198.201]) by msg-mx10.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG000B27EGGGQ0@msg-mx10.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 23:30:16 -0700 (PDT) Received: (qmail 34113 invoked from network); Sun, 16 Sep 2007 06:30:16 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp102.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:30:16 +0000 Date: Sat, 15 Sep 2007 23:29:31 -0700 From: Leslie Cheung Subject: RE: warmup #1 In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOG000B37EGGGQ0@msg-mx10.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4D4HYnouQqNdjTAeqnLCl6eA2fAACu6NA X-YMail-OSG: EmU8_4AVM1mTRoJdj9oF7NVZ77juiJfjCwwQQNiDyemK2fbm Someone wrote: > for this "client -f localhost:$port /etc/shadow " I am getting filesize request for > /etc/shadow' failed and my server displays the message error in opening file. > My friend is getting the size of the file. And i am using "stat". Even I am not using > fopen. > Can you tell me what is wrong? earlier I thought it should return me the response > filesize request failed but my friend is getting the filesize. My comment is: keep trying. If you can get the size of the file by calling "ls" on the console, your server should be able to get the file size. If not, something is wrong. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 23:31:22 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx9.usc.edu (msg-mx9.usc.edu [128.125.137.27]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G6VMdP017913 for ; Sat, 15 Sep 2007 23:31:22 -0700 Received: from smtp108.sbc.mail.mud.yahoo.com ([68.142.198.207]) by msg-mx9.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG000XJ7BHKX10@msg-mx9.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 23:28:29 -0700 (PDT) Received: (qmail 58506 invoked from network); Sun, 16 Sep 2007 06:28:29 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp108.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:28:28 +0000 Date: Sat, 15 Sep 2007 23:27:43 -0700 From: Leslie Cheung Subject: RE: Malicious client In-reply-to: <46EC9BEC.50901@usc.edu> To: cs551@merlot.usc.edu Message-id: <0JOG000XK7BHKX10@msg-mx9.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4DaIH3oHSt6rqSha2WodIr6/AygADMmSQ X-YMail-OSG: vd8is_UVM1lIjCZF5vYdSTmaV8EyqArBzOI2CNazorb5feNX Someone wrote: > During following test of malicious server #3 and #4, My client doesnt > print anything until the server times out is that fine? It doesn't sound very reasonable to me. If a malicious server sends you only the header but not sending any data, isn't there something wrong? --Leslie > Leslie Cheung wrote: > > Someone wrote: > > > > > >> While testing malicious server #3 and #4 I get following message on > >> > > server: > > > >> Caught signal 14. > >> wserver: alarm went off. > >> > >> Is this fine? > >> > > > > This is what our server prints out when it auto-shutdown. When we grade we > > focus on what your client does. > > > > --Leslie > > > > > > Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 23:27:39 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from msg-mx8.usc.edu (msg-mx8.usc.edu [128.125.137.26]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G6RdXl017679 for ; Sat, 15 Sep 2007 23:27:39 -0700 Received: from smtp107.sbc.mail.mud.yahoo.com ([68.142.198.206]) by msg-mx8.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOG00E1Y75ATOV1@msg-mx8.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 23:24:46 -0700 (PDT) Received: (qmail 46637 invoked from network); Sun, 16 Sep 2007 06:24:46 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp107.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 06:24:45 +0000 Date: Sat, 15 Sep 2007 23:24:00 -0700 From: Leslie Cheung Subject: RE: Regarding malicious client #4 & #5 In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOG00E1Z75ATOV1@msg-mx8.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4Cc65pcb5llYgTFeJpcnTlgTpbgAAe1XQ X-YMail-OSG: mTEpoygVM1kJkdQ56NHK5N_oXKyv2eCCAdtp4cVHPOtcXZRB Someone wrote: > I just checked, the server is unable to give the ALL_FAIL message to client, because > it closes the socket while waiting: > write is returning 1 > In Malicious client #4 & #5, the client waits for a few seconds before exiting. Your server have time to send ALL_FAIL to the client. If the client exits before your server has sent anything, according to the grading guidelines, that's fine. But it's a good idea to print out a warning message saying something might have gone wrong. --Leslie > ----- Original Message ----- > Date: Saturday, September 15, 2007 7:27 pm > Subject: Regarding malicious client #4 & #5 > To: Leslie Cheung > > > Hi Leslie , > > For malicious client #4, i time out waitng for data after say 5s > > and send ALL_FAIL to client. > > I get the following message in the client : "Malformed reply > > received.". > > Also for the following malcious client: > > ~csci551b/public/warmup1/wclient -5 localhost:$port /bin/ls 10, > > i wait for data for 5s(i dont get it), so i send ALL_FAIL. I get > > the same : "Malformed reply received.". message at the client. > > > > Are these the expected behavior of these malicious client i.e. do > > these clients print "Malformed reply received.". once they > > encounter failure messages? Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 19:54:25 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G2sPwx006667 for ; Sat, 15 Sep 2007 19:54:25 -0700 Received: from smtp108.sbc.mail.mud.yahoo.com ([68.142.198.207]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with SMTP id <0JOF00NW1X9X29D0@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 19:51:33 -0700 (PDT) Received: (qmail 70204 invoked from network); Sun, 16 Sep 2007 02:44:53 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp108.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 02:44:52 +0000 Date: Sat, 15 Sep 2007 19:44:08 -0700 From: Leslie Cheung Subject: RE: Malicious client In-reply-to: <46EC90AE.2030300@usc.edu> To: cs551@merlot.usc.edu Message-id: <0JOF00NW2X9X29D0@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4Buw5o2xKx3NSQSW5XUCCn2zYYwAAnlCw X-YMail-OSG: NOd7abAVM1lMllGIaTrpGrvmBHZEEKtSIXMQ6U91pCbxsfZ4 Someone wrote: > While testing malicious server #3 and #4 I get following message on server: > Caught signal 14. > wserver: alarm went off. > > Is this fine? This is what our server prints out when it auto-shutdown. When we grade we focus on what your client does. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 19:52:35 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from msg-mx9.usc.edu (msg-mx9.usc.edu [128.125.137.27]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G2qZ3w006545 for ; Sat, 15 Sep 2007 19:52:35 -0700 Received: from smtp107.sbc.mail.mud.yahoo.com ([68.142.198.206]) by msg-mx9.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF009E7X6V2HD0@msg-mx9.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 19:49:43 -0700 (PDT) Received: (qmail 88823 invoked from network); Sun, 16 Sep 2007 02:49:42 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp107.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 02:49:42 +0000 Date: Sat, 15 Sep 2007 19:48:56 -0700 From: Leslie Cheung Subject: RE: RE: warmup #1 In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOF009E8X6V2HD0@msg-mx9.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4C7NPoA5o/ENSTd2itvIFonW9LQAAAx9Q X-YMail-OSG: noJzAKAVM1ll1nd5BlhfS17JrxDy9jh6OO5bkS56sExGjgAq Someone wrote: > So can I use cc compiler instead of gcc without -w.Will there be any penalty for this? You can use the cc compiler if you wish. But please do not use the "-w" option. --Leslie > ----- Original Message ----- > From: Leslie Cheung > Date: Saturday, September 15, 2007 7:36 pm > Subject: RE: warmup #1 > To: cs551@merlot.usc.edu > > > Someone wrote: > > > > > My question is regarding makefile. > > > I am using "cc" to compile my code and there is no -Wall option > > for that. > > Is "-w" in > > > cc similar to -Wall of gcc. > > > Because when I gcc compiler to compile and link my files it does > > not show > > me any > > > warnings but my client doesnot show any output. I do not why? > > > > > > But when i compile without makefile using gcc then my program runs > > perfectly. Also > > > when I run my program with makefile which uses cc compiler then > > also my > > code > > > runs perfectly fine. > > > > > > So can I use cc compiler with "-w" command. > > > > The man page of cc says "-w" *suppresses* compiler warnings! So you > > shouldnot use "-w" for cc. The man page of cc also says by default > > it prints all > > warning messages. > > > > --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 19:51:22 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G2pMGm006411 for ; Sat, 15 Sep 2007 19:51:22 -0700 Received: from smtp110.sbc.mail.mud.yahoo.com ([68.142.198.209]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with SMTP id <0JOF00NHZX4T2AE0@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 19:48:30 -0700 (PDT) Received: (qmail 74877 invoked from network); Sun, 16 Sep 2007 02:48:29 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp110.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 02:48:29 +0000 Date: Sat, 15 Sep 2007 19:47:44 -0700 From: Leslie Cheung Subject: RE: bad port In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOF00NI0X4T2AE0@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4Ctrx6jWicG5ST7iousyD1933LwAAOOig X-YMail-OSG: vH.RRFYVM1mzoxgNhIphGXzplsj5Rpvw1uWnY3JgJlN6cXhC Someone wrote: > Then how do we pass the following test from the grading guidelines? > > ./server 80 > (bad port, the server should quit) Please see Bill's message with timestamp "Sun 09 Sep 18:40". --Leslie > On 9/15/07, Leslie Cheung wrote: > > Someone wrote: > > > > > Should I limit the port which can be used > > > to just those ports assigned to me? > > > > No! Please do not do anything to limit the range of port numbers you can > > use. When we grade we use different ports. > > > > --Leslie > > > > > > Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 19:46:28 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G2kSHJ006151 for ; Sat, 15 Sep 2007 19:46:28 -0700 Received: from smtp115.sbc.mail.sp1.yahoo.com ([69.147.64.88]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF00DUYWWOEHC0@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 19:43:36 -0700 (PDT) Received: (qmail 48685 invoked from network); Sun, 16 Sep 2007 01:43:36 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp115.sbc.mail.sp1.yahoo.com with SMTP; Sun, 16 Sep 2007 01:43:35 +0000 Date: Sat, 15 Sep 2007 18:42:51 -0700 From: Leslie Cheung Subject: RE: Malicious client In-reply-to: <46EC883C.10604@usc.edu> To: cs551@merlot.usc.edu Message-id: <0JOF00DUZWWOEHC0@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4AeVbP3uDRySZQ3SGa/+CCjX2vQAAEm/w X-YMail-OSG: 2FAFfrcVM1n7tLOodoIQrAe8GeBKNB.2B4aSYqnDRsdlRt4c Someone wrote: > For: > > Test server against malicious client #3 : -3 points > ./server $port > (the following client will send a header 6 bytes long and > close the socket, server should attempt to send > ALL_FAIL) > ~csci551b/public/warmup1/wclient -3 localhost:$port > /etc/passwd > > > My server creates ALL_FAIL packet, writes a message that its sending ALL_FAIL, > then it tries to send the packet to client. > It can send first 2/3 bytes then it receives SIGPIPE, so while handling this signal, > should the server just write the error message or > should it also close everything and exit? Your server should be robust, meaning that whatever happens, it should try its best to survive. If your server closes all the sockets and exits when you receive a bad request, it does not sound very robust. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 19:42:19 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G2gJ6J005918 for ; Sat, 15 Sep 2007 19:42:19 -0700 Received: from smtp107.sbc.mail.mud.yahoo.com ([68.142.198.206]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF005LZWPRRKD0@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 19:39:27 -0700 (PDT) Received: (qmail 83065 invoked from network); Sun, 16 Sep 2007 02:39:27 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp107.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 02:39:26 +0000 Date: Sat, 15 Sep 2007 19:38:42 -0700 From: Leslie Cheung Subject: RE: Regarding malicious client #4 & #5 In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOF005M1WPRRKD0@msg-mx1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4CSc8h5/yLxXOTP63hs2XYTk9MQAAIn/g X-YMail-OSG: zt.4sAAVM1l6RMMClwswidpIkUm1Hp9Q2yMc1zvD7.HdD1mr Someone wrote: > For malicious client #4, i time out waitng for data after say 5s and send ALL_FAIL to > client. > I get the following message in the client : "Malformed reply received.". > > Also for the following malcious client: ~csci551b/public/warmup1/wclient -5 > localhost:$port /bin/ls 10, > i wait for data for 5s(i dont get it), so i send ALL_FAIL. I get the same : > "Malformed reply received.". message at the client. > > Are these the expected behavior of these malicious client i.e. do these clients print > "Malformed reply received.". once they encounter failure messages? No, it looks like you are not formatting you ALL_FAIL message correctly. You should get something like "ALL_FAIL received". Please read the spec carefully again to see if you are formatting your message correctly. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 19:38:49 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx10.usc.edu (msg-mx10.usc.edu [128.125.137.28]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G2cntD005689 for ; Sat, 15 Sep 2007 19:38:49 -0700 Received: from smtp107.sbc.mail.mud.yahoo.com ([68.142.198.206]) by msg-mx10.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF00FCBWJWAEE0@msg-mx10.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 19:35:57 -0700 (PDT) Received: (qmail 81372 invoked from network); Sun, 16 Sep 2007 02:35:56 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp107.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 02:35:56 +0000 Date: Sat, 15 Sep 2007 19:35:11 -0700 From: Leslie Cheung Subject: RE: warmup #1 In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOF00FCCWJWAEE0@msg-mx10.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4BvbzmyksaUIFSNijUFQj6fFyBgAAZkMg X-YMail-OSG: Jl9lDUEVM1kO7Hl6ztHNR4S0Iv3synzaEQ3Z1f7zoJsKHsIg Someone wrote: > My question is regarding makefile. > I am using "cc" to compile my code and there is no -Wall option for that. Is "-w" in > cc similar to -Wall of gcc. > Because when I gcc compiler to compile and link my files it does not show me any > warnings but my client doesnot show any output. I do not why? > > But when i compile without makefile using gcc then my program runs perfectly. Also > when I run my program with makefile which uses cc compiler then also my code > runs perfectly fine. > > So can I use cc compiler with "-w" command. The man page of cc says "-w" *suppresses* compiler warnings! So you should not use "-w" for cc. The man page of cc also says by default it prints all warning messages. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 19:35:06 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G2Z6aW005462 for ; Sat, 15 Sep 2007 19:35:06 -0700 Received: from smtp113.sbc.mail.mud.yahoo.com ([68.142.198.212]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF00J91WDQCR00@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 19:32:14 -0700 (PDT) Received: (qmail 57228 invoked from network); Sun, 16 Sep 2007 02:32:13 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp113.sbc.mail.mud.yahoo.com with SMTP; Sun, 16 Sep 2007 02:32:13 +0000 Date: Sat, 15 Sep 2007 19:31:29 -0700 From: Leslie Cheung Subject: RE: bad port In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOF00J92WDQCR00@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4B7NNUJriRWRdTtql2Xd7283LLgAAc6iA X-YMail-OSG: Ax7GSxoVM1lVd.688jt2jfvKXq7IgETmXqGo2nc4Xgm08S6l Someone wrote: > Should I limit the port which can be used > to just those ports assigned to me? No! Please do not do anything to limit the range of port numbers you can use. When we grade we use different ports. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 18:52:42 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx10.usc.edu (msg-mx10.usc.edu [128.125.137.28]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G1qgPL003274 for ; Sat, 15 Sep 2007 18:52:42 -0700 Received: from smtp120.sbc.mail.sp1.yahoo.com ([69.147.64.93]) by msg-mx10.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF00CFPUF23XF0@msg-mx10.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 18:49:50 -0700 (PDT) Received: (qmail 2235 invoked from network); Sun, 16 Sep 2007 01:49:50 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp120.sbc.mail.sp1.yahoo.com with SMTP; Sun, 16 Sep 2007 01:49:49 +0000 Date: Sat, 15 Sep 2007 18:49:05 -0700 From: Leslie Cheung Subject: RE: warmup1 In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOF00CFQUF23XF0@msg-mx10.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4Am1Bz8aY2/kkQgug84oBWtUMRAAAStmw X-YMail-OSG: RJaHzI0VM1nZxc1OFQo7a3nj.v8QXdRcGpZcmPAFYKTepIr5 Someone wrote: > In my code I use unit16_t and unit32_t. When I run this code on my own computer, I > just define unit32_t int. > > How can I do this on nunki? do I need to include some header files? thank you!~ I think uint32_t and uint16_t are defined in unistd.h. You should do include this header file if you are using uint16_t and uint16_t. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 18:39:29 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G1dTEP002494 for ; Sat, 15 Sep 2007 18:39:29 -0700 Received: from smtp121.sbc.mail.sp1.yahoo.com ([69.147.64.94]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF00JR6TT09Q31@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 18:36:37 -0700 (PDT) Received: (qmail 80796 invoked from network); Sun, 16 Sep 2007 01:36:36 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp121.sbc.mail.sp1.yahoo.com with SMTP; Sun, 16 Sep 2007 01:36:36 +0000 Date: Sat, 15 Sep 2007 18:35:49 -0700 From: Leslie Cheung Subject: RE: About grading In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOF00JR7TT19Q31@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf4ALvu8SR9OguoQMuPWimm929wIAAAPVDw X-YMail-OSG: fHzfKSsVM1kvgI1oWbRHqQUjHJa1MAjrzJetFsnjtVjZdvXh Someone wrote: > Sorry I didn't get this: > > Compiler warning : if compile using gcc/g++, make sure "-Wall" is in each > compile command in the make > > Could you tell me what's this, please? When you compile your code, you should use the option "-Wall" so that it'll print all warning messages. For example, gcc client.c -c -g -Wall If the grader sees any warning messages, you will lose 1 point per warning (up to 5 points). --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 18:37:40 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_20 autolearn=no version=3.2.0 Received: from msg-mx7.usc.edu (msg-mx7.usc.edu [128.125.137.25]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G1bdvH002316 for ; Sat, 15 Sep 2007 18:37:39 -0700 Received: from smtp118.sbc.mail.sp1.yahoo.com ([69.147.64.91]) by msg-mx7.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF0095KTPZ0B10@msg-mx7.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 18:34:48 -0700 (PDT) Received: (qmail 4688 invoked from network); Sun, 16 Sep 2007 01:34:47 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp118.sbc.mail.sp1.yahoo.com with SMTP; Sun, 16 Sep 2007 01:34:46 +0000 Date: Sat, 15 Sep 2007 18:34:02 -0700 From: Leslie Cheung Subject: RE: Malicious Client kills my server In-reply-to: <42b5eb970709151752x66e1ad82ybd6d3a702f2d0144@mail.gmail.com> To: cs551@merlot.usc.edu Message-id: <0JOF0095LTPZ0B10@msg-mx7.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3+99irSBjXjUWTBeZc3pmy+i6xQAA3vVA X-YMail-OSG: tWHTSSMVM1l34Iu7wLPwqwc.MTsdTkejjgORDrV_PsCvZZ0RRTF6wBGY_6y1K0vGHP7ZudJ0ZFpf18rGZxYtXN_YxV0TUDPlbhQ- Someone wrote: > est client against malicious server #5 : -2 points > (the following server will pause for 20 seconds > between sending > the header and the data, the client should > work as normal, > if the client timeout and prints reasonable > message, that's > fine too) > ~csci551b/public/warmup1/wserver -5 $port 20 > ./client -a localhost:$port www.cs.usc.edu > > (the following server will pause for 2 seconds > between sending > the header and the data, the client should > work as normal) > ~csci551b/public/warmup1/wserver -5 $port 2 > ./client -a localhost:$port www.cs.usc.edu > > i noticed that the malicious server only sends 4 bytes of header > before waiting..is this correct?? Yes, I think the malicious server is sending 4 bytes before going to sleep. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 18:14:28 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx9.usc.edu (msg-mx9.usc.edu [128.125.137.27]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G1ES9W001073 for ; Sat, 15 Sep 2007 18:14:28 -0700 Received: from smtp120.sbc.mail.sp1.yahoo.com ([69.147.64.93]) by msg-mx9.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF0098MSNC2L40@msg-mx9.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 18:11:37 -0700 (PDT) Received: (qmail 85216 invoked from network); Sun, 16 Sep 2007 01:11:36 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp120.sbc.mail.sp1.yahoo.com with SMTP; Sun, 16 Sep 2007 01:11:36 +0000 Date: Sat, 15 Sep 2007 18:10:52 -0700 From: Leslie Cheung Subject: RE: accept() In-reply-to: <002301c7f7fd$f7022d10$6401a8c0@Delled> To: cs551@merlot.usc.edu Message-id: <0JOF0098OSNC2L40@msg-mx9.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3/fVxpgS2BxtmSjmW/QdHRGgLNAAAB0OQ X-YMail-OSG: gFaCQOwVM1k0jMfjLL8JpV.AgSEdPgXoZmW4qsxXIGJn3Ckq Someone wrote: > I am using fork() to handle incomming connections. > Everything works fine, the only thing is that my server will dump > accept:Interrupt system call > when ever a child process finish its job. > This seams not affect my server, it still can handle other connections, and > properly shutdown. > Could you please tell my why accept report an error? My guess is your child process sends SIGCHLD when it exits. You can create a handler to take care of SIGCHLD, or just ignore it (by calling "signal(SIGCHLD, SIG_IGN)"). --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 17:57:06 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx10.usc.edu (msg-mx10.usc.edu [128.125.137.28]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8G0v6u8032562 for ; Sat, 15 Sep 2007 17:57:06 -0700 Received: from smtp121.sbc.mail.sp1.yahoo.com ([69.147.64.94]) by msg-mx10.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF00CEWRUE3YA0@msg-mx10.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 17:54:14 -0700 (PDT) Received: (qmail 60910 invoked from network); Sun, 16 Sep 2007 00:54:14 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp121.sbc.mail.sp1.yahoo.com with SMTP; Sun, 16 Sep 2007 00:54:13 +0000 Date: Sat, 15 Sep 2007 17:53:29 -0700 From: Leslie Cheung Subject: RE: detecting that socket is closed at server side In-reply-to: <42b5eb970709151442o559e8b48of8c9d1185b844dca@mail.gmail.com> To: cs551@merlot.usc.edu Message-id: <0JOF00CEXRUE3YA0@msg-mx10.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf34WBg6EJ9IzrwTNasSU9+vy5CyQAC0f7g X-YMail-OSG: EY6VWF0VM1n.R3QWZBN0yjWa7xwPqLzFpa2LRT0YrOoT4PPd Someone wrote: > for the case when i have to do shutdown during long file transfer, > my server child and parent process shuts down properly and i am also > closing the sockets. > > at the client side, i did notice that the file transfer keeps > happening, but after a while the number of bytes received becomes zero > does this indicate that i have closed the socket successfully at the > server side?? > because i need some method for the client to know that the server has > shut down... What I would do is when read() returns 0 for many times, close the socket because this indicates that something is possibly wrong on the other side. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 16:19:00 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_20 autolearn=no version=3.2.0 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8FNJ0cI027406 for ; Sat, 15 Sep 2007 16:19:00 -0700 Received: from smtp123.sbc.mail.sp1.yahoo.com ([69.147.64.96]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF00JCYNAWXOA0@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 16:16:08 -0700 (PDT) Received: (qmail 49195 invoked from network); Sat, 15 Sep 2007 23:09:27 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp123.sbc.mail.sp1.yahoo.com with SMTP; Sat, 15 Sep 2007 23:09:27 +0000 Date: Sat, 15 Sep 2007 16:08:43 -0700 From: Leslie Cheung Subject: RE: Malicious Client kills my server In-reply-to: <42b5eb970709151537w79fbbec3mb7a43359aed655ee@mail.gmail.com> To: cs551@merlot.usc.edu Message-id: <0JOF00JCZNAWXOA0@msg-mx1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf36d4ojmD6oQtWQz2Tfa6dWN3eMwAAvblg X-YMail-OSG: jxGLXaoVM1m5PSnE24GN80_C_0rHlGAPufF0HMRiKjS8_RxI Someone wrote: > Test server against malicious client #4 : -3 points > ./server $port > (the following client will send a header 4 bytes long and > waits, should get ALL_FAIL after a > reasonable timeout; > if the client finishes before the server times out, > that's fine too) > ~csci551b/public/warmup1/wclient -4 > localhost:$port /etc/passwd > > in this, my server is sending ALL FAIL, > but the client just prints : No data read. > > is it necessary that the client should print an ALL FAIL message? It's pretty clear from above that "if the client finishes before the server times out, that's fine too". I think it's a good idea for the server to either print out a warning message, or log this event in the log file. That way the grader knows you are handling it properly. I'd also try changing the timeout and see if your server is sending ALL_FAIL. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 16:07:10 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8FN7AdI026780 for ; Sat, 15 Sep 2007 16:07:10 -0700 Received: from smtp124.sbc.mail.sp1.yahoo.com ([69.147.64.97]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOF00G4UMR6O0Y0@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 16:04:18 -0700 (PDT) Received: (qmail 39054 invoked from network); Sat, 15 Sep 2007 23:04:18 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp124.sbc.mail.sp1.yahoo.com with SMTP; Sat, 15 Sep 2007 23:04:17 +0000 Date: Sat, 15 Sep 2007 16:03:33 -0700 From: Leslie Cheung Subject: RE: make error In-reply-to: <46EC5984.6060608@usc.edu> To: cs551@merlot.usc.edu Message-id: <0JOF00G4VMR6O0Y0@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf35gwLNB8jtRAoTtmtX4bAfudEnwABeWCA X-YMail-OSG: B64DH8wVM1kWowsSZgM.lRXTorQxuBs6Ga0fr7gwRZt6nJcF Someone wrote: > I get an an error of the sort : Fatal Error: Dont know how to make target. > when I run make > > but when I run the steps line by line through the console, it works > perfectly for me. > > Any hints on whats going wrong ? Let's say you are trying to write a Makefile such that when you type "make server" it will create an executable for the server. In this case, you need to create a rule called "server". For example, server: gcc server.c -o server Please look for a tutorial on Makefile for details. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 14:12:40 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8FLCeFq020744 for ; Sat, 15 Sep 2007 14:12:40 -0700 Received: from smtp118.sbc.mail.sp1.yahoo.com ([69.147.64.91]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with SMTP id <0JOF00G9NHGDI522@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 14:09:49 -0700 (PDT) Received: (qmail 73528 invoked from network); Sat, 15 Sep 2007 21:09:48 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp118.sbc.mail.sp1.yahoo.com with SMTP; Sat, 15 Sep 2007 21:09:48 +0000 Date: Sat, 15 Sep 2007 14:09:04 -0700 From: Leslie Cheung Subject: RE: Malicious Client kills my server In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOF00G9OHGDI522@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf32f+BUmoVC9m5RYe6nPNVZXX/LwAAc62w X-YMail-OSG: 1KeVK3cVM1m7DLl1OqtMD89TkEQSCIZgeWdA8l.aFk2GDobf Someone wrote: > For the case 3 & 4 in the malicious client, whenever the client quits, I get "write: > accept Broken pipe" error on server side and server quits. I have written code to > catch Broken Pipe Event also, but I am not able to avoid the abnormal quitting of the > server. Can you please suggest what should I use in the handler to keep server > alive. Broken pipe usually happens when you try to read/write a socket that has been closed. I suggest you to start a debugger and see which line gives you SIGPIPE. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 13:19:06 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_20 autolearn=no version=3.2.0 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8FKJ640017939 for ; Sat, 15 Sep 2007 13:19:06 -0700 Received: from smtp120.sbc.mail.sp1.yahoo.com ([69.147.64.93]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with SMTP id <0JOF002MPEYRVD02@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 13:16:15 -0700 (PDT) Received: (qmail 37718 invoked from network); Sat, 15 Sep 2007 20:16:01 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp120.sbc.mail.sp1.yahoo.com with SMTP; Sat, 15 Sep 2007 20:16:01 +0000 Date: Sat, 15 Sep 2007 13:15:17 -0700 From: Leslie Cheung Subject: RE: About makefile In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOF002MREYRVD02@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3mzl/dZZNOFyGTNS5m+8j27cmJgAOZV4g X-YMail-OSG: TwEaENkVM1lf4_czh.xQJDMPrmPiY41h6Ykfe78kIOQoDKdB Someone wrote: > I run into a problem that when I use the commandline to create object like this: > gcc -c myfile.c -Wall > It doesn't return any error, but when I use makefile with the same command inside,: > myfile.o: myfile.c > gcc -c myfile.c -Wall > I got lots of undeclared variables which mostly come from openssl/md5.h and > netdb.h. > my programs can be compiled and run in the unix commandline with no problem. I > wonder what is the problem with my makefile, do I miss something in there? I think you forgot to put the "-I" options in your makefile. When you compile your code (convert .c to .o), you need to put the "-I" things to include the MD5 files properly. When you do linking (convert .o to an executable), you need to link the proper library (e.g., "-lsocket"). --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 02:06:27 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F96Roh014895 for ; Sat, 15 Sep 2007 02:06:27 -0700 Received: from smtp108.sbc.mail.mud.yahoo.com ([68.142.198.207]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOE00KVBJU2A070@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 02:03:39 -0700 (PDT) Received: (qmail 87810 invoked from network); Sat, 15 Sep 2007 09:03:38 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp108.sbc.mail.mud.yahoo.com with SMTP; Sat, 15 Sep 2007 09:03:38 +0000 Date: Sat, 15 Sep 2007 02:02:55 -0700 From: Leslie Cheung Subject: RE: Parent Socket Shutdown error In-reply-to: <42b5eb970709150110v65ac0ff6w8d3e2234717a5ef6@mail.gmail.com> To: cs551@merlot.usc.edu Message-id: <0JOE00KVDJU2A070@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3cL4IpnMJXC9YR7Wu7MdKMnirswABVJfg X-YMail-OSG: inRAk2oVM1l1wED6Q2rqUf8BRI7sUdxAhVEW7_I7F7RmtPXN Someone wrote: > what if i declare the sockets as global? No. Since the parent process and the child process are in different address space, closing a socket in the parent process does not affect anything in the child process. To gracefully shutdown your server, when your parent process exits, you have to close all sockets on both parent and child processes, and make sure all child process terminates (by sending them signals if needed) before exiting the parent process. --Leslie > On 9/14/07, Leslie Cheung wrote: > > Someone wrote: > > > > > There is this one problem i encounter everytime i either do a shut down on > > the > > > server or hit ctrl C. The server shuts down, however the client continues > > to receive > > > the data *completely* from the server. I have written my own event > > handlers for both > > > the alarm and ctrl c conditions. > > > > > > The handler ensures the parent and child sockets are shut down and the > > process is > > > also being killed. Just as the professor suggested, i did a shut down > > before closing > > > the socket and for each of the cases(alarm and ctrl c), the shutdown > > returns with an > > > error(-1) only for the parent socket . > > > > > > Would you be able to advice me on this issue. > > > > Once you have called fork(), the parent and child processes are two > > different processes, and have their own address space. You cannot close a > > socket on the child process from the parent process. My guess is you close > > the socket that connects to the client in the parent process, but not in the > > child process. > > > > It also seems to me that you did not wait the child process to exit when the > > parent process exit. You should call wait() when the parent process exits. > > > > --Leslie > > > > > > Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 01:35:27 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_20 autolearn=no version=3.2.0 Received: from msg-mx8.usc.edu (msg-mx8.usc.edu [128.125.137.26]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F8ZRhf013220 for ; Sat, 15 Sep 2007 01:35:27 -0700 Received: from smtp109.sbc.mail.mud.yahoo.com ([68.142.198.208]) by msg-mx8.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOE005Z9IECEPR0@msg-mx8.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 01:32:39 -0700 (PDT) Received: (qmail 71420 invoked from network); Sat, 15 Sep 2007 08:32:36 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp109.sbc.mail.mud.yahoo.com with SMTP; Sat, 15 Sep 2007 08:32:35 +0000 Date: Sat, 15 Sep 2007 01:31:53 -0700 From: Leslie Cheung Subject: RE: Query regarding Malicious client In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOE005ZAIECEPR0@msg-mx8.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3bJaw6c7CbNzTRhuEXYluKI/6GgABAGgg X-YMail-OSG: JJnkNVMVM1mQsg9oqQFeG1yOCgAcwtsRMXtsr_2tVG9k5pz_ Someone wrote: > One of the Malicious Client Cases is ~csci551b/public/warmup1/wclient -2 > localhost:$port /etc/passwd. Here expected o/p is "ADR_FAIL". But it's also > mentioned that "A very large size data should be handled properly". What I am doing > is if a data size is above a specific threshold, my server is not performing any task, > but sending ALL_FAIL message. > So is that fine if my server sends "ALL_FAIL" instead of "ADR_FAIL" in the above > case? Please let me know. Thank you very much. Putting a reasonable threshold (you have to decide what's reasonable) on ADR requests is ok. If the data size is larger than your threshold, I think it should be fine to send either ALL_FAIL or ADR_FAIL. But you need to make sure that for GET requests, your server shouldn't just send ALL_FAIL and exits when the file is large; you should send the file. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sat Sep 15 00:43:57 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx7.usc.edu (msg-mx7.usc.edu [128.125.137.25]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F7hvej010500 for ; Sat, 15 Sep 2007 00:43:57 -0700 Received: from smtp109.sbc.mail.mud.yahoo.com ([68.142.198.208]) by msg-mx7.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOE00E3PG0K3C70@msg-mx7.usc.edu> for cs551@merlot.usc.edu; Sat, 15 Sep 2007 00:41:09 -0700 (PDT) Received: (qmail 32282 invoked from network); Sat, 15 Sep 2007 07:41:08 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp109.sbc.mail.mud.yahoo.com with SMTP; Sat, 15 Sep 2007 07:41:08 +0000 Date: Sat, 15 Sep 2007 00:40:25 -0700 From: Leslie Cheung Subject: submitting warmup1 To: cs551@merlot.usc.edu Message-id: <0JOE00E3QG0K3C70@msg-mx7.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3a63u26cUFJOnSjeBJBYuFX6feg== X-YMail-OSG: Wl59JQ0VM1mieyz.Et_ASQv3RZ_wzZdFZ7QRZFJ7Nv19rOUf Hi, If you haven't tried using bsubmit to submit your project, you should try it now. Our submission system is different from what you might have used for other classes, and you can submit multiple times. We can grade any on-time submissions, and by default, we grade the latest on-time submission (Please email Dr Cheng if you want us to grade a version other than the latest on-time submission). I strongly recommend you to submit whatever you currently have, so you can learn how to submit. Please note that we cannot give you any extension if you have problems with submitting your project at the last minute! --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 23:17:54 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx8.usc.edu (msg-mx8.usc.edu [128.125.137.26]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F6Hsmq006050 for ; Fri, 14 Sep 2007 23:17:54 -0700 Received: from smtp104.sbc.mail.mud.yahoo.com ([68.142.198.203]) by msg-mx8.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOE005L8C15EPH0@msg-mx8.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 23:15:06 -0700 (PDT) Received: (qmail 20639 invoked from network); Sat, 15 Sep 2007 06:15:05 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp104.sbc.mail.mud.yahoo.com with SMTP; Sat, 15 Sep 2007 06:15:05 +0000 Date: Fri, 14 Sep 2007 23:14:23 -0700 From: Leslie Cheung Subject: RE: Parent Socket Shutdown error In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOE005L9C15EPH0@msg-mx8.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3TIJcD117o470RfmoYF3u/v3RDwADWmuA X-YMail-OSG: giuuIlsVM1nTsj9VRf6lrDL318ZEteNuT0nKpMaZW7XhBeXa Someone wrote: > There is this one problem i encounter everytime i either do a shut down on the > server or hit ctrl C. The server shuts down, however the client continues to receive > the data *completely* from the server. I have written my own event handlers for both > the alarm and ctrl c conditions. > > The handler ensures the parent and child sockets are shut down and the process is > also being killed. Just as the professor suggested, i did a shut down before closing > the socket and for each of the cases(alarm and ctrl c), the shutdown returns with an > error(-1) only for the parent socket . > > Would you be able to advice me on this issue. Once you have called fork(), the parent and child processes are two different processes, and have their own address space. You cannot close a socket on the child process from the parent process. My guess is you close the socket that connects to the client in the parent process, but not in the child process. It also seems to me that you did not wait the child process to exit when the parent process exit. You should call wait() when the parent process exits. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 23:13:15 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx3.usc.edu (msg-mx3.usc.edu [128.125.137.8]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F6DF8e005829 for ; Fri, 14 Sep 2007 23:13:15 -0700 Received: from smtp102.sbc.mail.mud.yahoo.com ([68.142.198.201]) by msg-mx3.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOE00ABKBTFO7F0@msg-mx3.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 23:10:27 -0700 (PDT) Received: (qmail 43059 invoked from network); Sat, 15 Sep 2007 06:10:27 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp102.sbc.mail.mud.yahoo.com with SMTP; Sat, 15 Sep 2007 06:10:26 +0000 Date: Fri, 14 Sep 2007 23:09:44 -0700 From: Leslie Cheung Subject: RE: Regarding warmup1 In-reply-to: <003401c7f754$0ec05df0$6501a8c0@Delled> To: cs551@merlot.usc.edu Message-id: <0JOE00ABLBTFO7F0@msg-mx3.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3VAz0RjPYXCCQSr6FXIjBRGITxQABoCSg X-YMail-OSG: yCrXpXYVM1mJ2yOUtqF6La.HzUyxMHXQU7DyliQ8EU7P8rWC Someone wrote: > I met a problem that I try to write something on a socket that the other > side has close the socket. > write should not work. > But my program just exit unproperly, while write did not reture 0 or -1. What happen then? Did you catch the error? Do you get any message? Seg fault? SIGPIPE? > What should write()return when the other side close the socket? It should return -1. Otherwise, write() should be ok, and your error might come from somewhere else. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 23:08:41 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx10.usc.edu (msg-mx10.usc.edu [128.125.137.28]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F68fTE005594 for ; Fri, 14 Sep 2007 23:08:41 -0700 Received: from smtp109.sbc.mail.mud.yahoo.com ([68.142.198.208]) by msg-mx10.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOE00D88BLTZ440@msg-mx10.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 23:05:53 -0700 (PDT) Received: (qmail 69571 invoked from network); Sat, 15 Sep 2007 06:05:53 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp109.sbc.mail.mud.yahoo.com with SMTP; Sat, 15 Sep 2007 06:05:52 +0000 Date: Fri, 14 Sep 2007 23:05:10 -0700 From: Leslie Cheung Subject: RE: warmup #1 In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOE00D89BLTZ440@msg-mx10.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3UIQn4fJyPQ46SK6NJKgYtYoyiQACZilg X-YMail-OSG: DtwKym4VM1nwjq8hknbtL4fSZHbDEFY7g7HXu3NSHzlAxEiM Someone wrote: > I was checking warnings in my program but unable to eliminate 1 , this warning is > " warning: statement not reached" > This warning is due to while(1) loop which I run on server side before accepting > connection. Can you tell me what can I do to eliminate this warning. I have checked > all my if else statement but they are fine. The problem is only with this when I > comment while(1) loop then I do not get this warning. If you have any statements after a loop like that, the compiler gives you the above warning. But why would you write code that can't be reached? Can you just remove those lines? --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 23:05:52 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx2.usc.edu (msg-mx2.usc.edu [128.125.137.7]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F65qvg005377 for ; Fri, 14 Sep 2007 23:05:52 -0700 Received: from smtp113.sbc.mail.mud.yahoo.com ([68.142.198.212]) by msg-mx2.usc.edu (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with SMTP id <0JOE00HK8BH4V1E0@msg-mx2.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 23:03:05 -0700 (PDT) Received: (qmail 40311 invoked from network); Sat, 15 Sep 2007 06:03:04 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp113.sbc.mail.mud.yahoo.com with SMTP; Sat, 15 Sep 2007 06:03:03 +0000 Date: Fri, 14 Sep 2007 23:02:21 -0700 From: Leslie Cheung Subject: RE: warmup1 query In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOE00HK9BH4V1E0@msg-mx2.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3TsK8skdH4HxwTKCVyTrtGlVNDwAC0bng X-YMail-OSG: hJuljS0VM1lyRYrwAMzUtGB7HQX_y8CMSHKK9O2DhO7nWZFCqb.NOfiExW1uPqLKfSyk7zZJcpqBtDAOFQ6vz51pfkkJt.BqXLZRr4hkQfo82oaZtgaIKDQ- Someone wrote: > When we run these do we get a file size because i get a failed > request. > ./client -f nunki.usc.edu:$port /home/scf-22/csci551b/hello > ./client -f localhost:$port /home/scf-22/csci551b/tmp/hello > Do these files exist. Because > "./client -f localhost:$port /etc/shadow" gives a result back > but > "./client -g localhost:$port /etc/shadow" doesn't which is md5 because we don't have > access rights for it If you can get the filesize by calling "ls" in the console, then you should be able to get the filesize. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 23:01:06 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx10.usc.edu (msg-mx10.usc.edu [128.125.137.28]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F61522005153 for ; Fri, 14 Sep 2007 23:01:05 -0700 Received: from smtp111.sbc.mail.mud.yahoo.com ([68.142.198.210]) by msg-mx10.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOE009WNB8VW5E0@msg-mx10.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 22:58:18 -0700 (PDT) Received: (qmail 33999 invoked from network); Sat, 15 Sep 2007 05:58:07 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp111.sbc.mail.mud.yahoo.com with SMTP; Sat, 15 Sep 2007 05:58:06 +0000 Date: Fri, 14 Sep 2007 22:57:24 -0700 From: Leslie Cheung Subject: RE: upper limit on the delay In-reply-to: <46EB6459.2070605@usc.edu> To: cs551@merlot.usc.edu Message-id: <0JOE009WPB8VW5E0@msg-mx10.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3U+dnOZlfCPEVQISmlauHk8uGNgABm0DQ X-YMail-OSG: u55YrKcVM1nnW4IHWtEQygCEUR8nzCDoNbYXHccdPBuE7lyR Someone wrote: > If we mention a particular upper limit on the delay (server "-d") in our > README file, can we be sure that grader would not exceed that limit. > This is because results with delay depend on our timout at the client. As I mentioned in my previous message (timestamp "Fri 14 Sep 16:49 "), you should put your design decision in the README file. If the grader thinks it's not good, you may lose points. I am not sure what you mean by "upper limit". What happen to your code if the delay exceeds the limit? For example, it's not ok if your code gives a seg fault if the delay is too long. On the other hand, if your client exits because the delay is too long, as long as you handle it reasonably, that should be ok. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 20:59:12 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx10.usc.edu (msg-mx10.usc.edu [128.125.137.28]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F3xCm2031083 for ; Fri, 14 Sep 2007 20:59:12 -0700 Received: from smtp108.sbc.mail.mud.yahoo.com ([68.142.198.207]) by msg-mx10.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOE005U75M0CHD0@msg-mx10.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 20:56:24 -0700 (PDT) Received: (qmail 52234 invoked from network); Sat, 15 Sep 2007 03:56:24 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp108.sbc.mail.mud.yahoo.com with SMTP; Sat, 15 Sep 2007 03:56:23 +0000 Date: Fri, 14 Sep 2007 20:55:41 -0700 From: Leslie Cheung Subject: RE: warmup1 query In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOE005U85M0CHD0@msg-mx10.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf3S5SJ/pxXZzzNQZaf3gRgHAQJBgAAG7Ug X-YMail-OSG: ZqGFWscVM1khfk1.jVtVyKFZDaNfaanPJ5zVl8IF6FQaN8KfDdZv3ClNQPUFjDnjzKTdoeKsb8qogO5XkLutXMWV4kXpVQq3a6x0 Someone wrote: > For the case mentioned below from guidelines, my client times > out in 10 seconds when no data is obtained, client then prints "something is wrong at > the server" as a result. Is that okay. > > ./server -d 15 $port > (start the following commands, one in each window, as > quickly as you can; there should be about 15 > seconds > delay in each response) > ./client -a localhost:$port pollux.usc.edu > ./client -a localhost:$port bourbon.usc.edu > ./client -a localhost:$port merlot.usc.edu You have to convince yourself if this is reasonable. Dr Cheng has stressed several times that you shouldn't be asking "is this okay"-kind of questions. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 19:35:25 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx5.usc.edu (msg-mx5.usc.edu [128.125.137.10]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F2ZP0U026777 for ; Fri, 14 Sep 2007 19:35:25 -0700 Received: from [204.57.0.20] by msg-mx5.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOE007IF1QELZC0@msg-mx5.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 19:32:38 -0700 (PDT) Date: Fri, 14 Sep 2007 19:32:18 -0700 From: Leslie Cheung Subject: Re: Regarding warmup1 In-reply-to: <000f01c7f73f$d6ce19a0$6501a8c0@Delled> Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46EB4432.3070909@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: <0JOC00FBWNR2KG50@msg-mx7.usc.edu> <000801c7f727$9e1b1a30$6501a8c0@Delled> <46EB2164.8060703@usc.edu> <000f01c7f73f$d6ce19a0$6501a8c0@Delled> User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Someone wrote: > Yes, I did checked -1. > What I have at the server side is : > > nunki.usc.edu(4): ~csci551b/public/warmup1/wclient -3 localhost:$port > /etc/passwd > This malicious client intentionally exits. > nunki.usc.edu(5): > > and nothing else. I think I should recieve something like: > All_FAIL recieved. > > But if the client exit, how can it know whether I am send ALL_FAIL or > not? > Yes, you can't, since the client has closed the socket before your server can send anything. Please see Dr. Cheng's message with timestamp "Tue 11 Sep 19:19 ". --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 19:25:36 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx5.usc.edu (msg-mx5.usc.edu [128.125.137.10]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F2Palq026252 for ; Fri, 14 Sep 2007 19:25:36 -0700 Received: from [204.57.0.20] by msg-mx5.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOE007C31A1GWF0@msg-mx5.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 19:22:49 -0700 (PDT) Date: Fri, 14 Sep 2007 19:22:29 -0700 From: Leslie Cheung Subject: Re: warmup1 query In-reply-to: Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46EB41E5.9040500@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: <46EB20BB.7050100@usc.edu> User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Someone wrote: > I found the mistake in my code and i get the long address now. Just wanted to know if i should print all the bytes received (as the guidelines say) or set a limit (because the answer usually should be within 15 bytes for ipv4) and just say that this is a malicious server. > > You should do something reasonable. In the README file, you might also want to say how you handle it and why. --Leslie > ----- Original Message ----- > From: Leslie Cheung > Date: Friday, September 14, 2007 5:01 pm > Subject: Re: warmup1 query > To: cs551@merlot.usc.edu > > >> Someone wrote: >> >> >>> Just had a doubt on "Test client against >>> >> malicious server #2" in grading guidelines. I get this at the >> client but the guidelines say it is a long reply by the server. Is >> there something wrong at the server side or i doing something >> wrong. >> >>> code=fe11 and length=1301 >>> hex-value of byte 6 received is 2e >>> hex-value of byte 7 received is 32 >>> hex-value of byte 8 received is 32 >>> hex-value of byte 9 received is 37 >>> hex-value of byte 10 received is 0 >>> finished >>> >> I have just tried... our server is sending a long reply for this >> ADDR >> request. You have to think about if you are doing things >> correctly. For >> example, what should you do when the server sends you an ADDR >> reply with >> a DataLength of 100? >> >> >> --Leslie >> >> >> Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 17:26:03 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from msg-mx5.usc.edu (msg-mx5.usc.edu [128.125.137.10]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F0Q3wB020135 for ; Fri, 14 Sep 2007 17:26:03 -0700 Received: from [204.57.0.20] by msg-mx5.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOD0078RVQSLUA0@msg-mx5.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 17:23:16 -0700 (PDT) Date: Fri, 14 Sep 2007 17:22:57 -0700 From: Leslie Cheung Subject: Re: warmup #1 In-reply-to: Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46EB25E1.2020206@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: <46EB1F5B.8070709@usc.edu> User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Someone wrote: > Yes you are right . Iam using fork() and my main process exits but childprocess is still active . So what Can I do to resolve that problem. > In the parent process you should call wait() so it won't exit until its child process has exited. You might also need to send a signal to the child process. --Leslie > ----- Original Message ----- > From: Leslie Cheung > Date: Friday, September 14, 2007 4:55 pm > Subject: Re: warmup #1 > To: cs551@merlot.usc.edu > > >> Someone wrote: >> >>> I have 1 query regarding the part below: >>> Failing auto-shutdown while long transfer in progress : -3 points >>> ./server -t 10 $port >>> (then immediately run the following in one >>> >> or multiple >> >>> windows, this should start a long >>> >> transfer)> ./client -g localhost:$port >> /home/scf-22/csci551b/public/cali.wav >> >>> (see if server exits properly after 10 >>> >> seconds)> >> >>> In this part my server exits after 10 seconds but the client >>> >> keeps on receiving the data that means the server exited but its >> still sending the data. So Can I use alarm on client side and exit >> the client when alarm goes off. >> >>> >>> >> Here, we focus on the behavior of the server. Your server should >> exit >> and stop any outstanding data transfer when it shutdowns. >> >> >>> Or Can you suggest me anything else ? What Am I doing wrong >>> >> because server exits but its still sending data. >> >>> >>> >> I think you are using fork(), and my guess is your child process is >> not >> killed when the main process exits. I can't tell for sure because I >> don't have enough information. >> >> >>> When server exits and when I try to connect to server from >>> >> another window then my new client do not connect to the server >> which is perfectly fine. But I believe that as soon as server exits >> it should stop transferring the data. >> >>> >>> >> It should stop the transfer. >> >> >>> In my catch alarm I am doing this: >>> void catch_alarm(int sig_num) >>> { >>> printf("\n\tTime out. Exiting...\n"); >>> exit(0); >>> } >>> >>> >>> >> Again, my guess is your main process exits when it runs the code >> above, >> but the child process is still running. >> >> >> --Leslie >> >> >> Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 17:06:54 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx0.usc.edu (msg-mx0.usc.edu [128.125.137.5]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F06sZl019066 for ; Fri, 14 Sep 2007 17:06:54 -0700 Received: from [204.57.0.20] by msg-mx0.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOD0015NUUVD460@msg-mx0.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 17:04:07 -0700 (PDT) Date: Fri, 14 Sep 2007 17:03:48 -0700 From: Leslie Cheung Subject: Re: Regarding warmup1 In-reply-to: <000801c7f727$9e1b1a30$6501a8c0@Delled> Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46EB2164.8060703@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: <0JOC00FBWNR2KG50@msg-mx7.usc.edu> <000801c7f727$9e1b1a30$6501a8c0@Delled> User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Someone wrote: > the following client will send a header 6 bytes long and > close the socket, server should attempt to send > ALL_FAIL) > ~csci551b/public/warmup1/wclient -3 > localhost:$port /etc/passwd > > > I failed for this test, because read() did not return 0. > How we surpose to test remote side close or not? (if read is not > return 0) > read() returns the number of bytes it reads (>=0), and -1 if there is an error. Did you check if read() return -1? --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 17:04:06 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx5.usc.edu (msg-mx5.usc.edu [128.125.137.10]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8F045kF018942 for ; Fri, 14 Sep 2007 17:04:05 -0700 Received: from [204.57.0.20] by msg-mx5.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOD0075WUQ6M4A0@msg-mx5.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 17:01:19 -0700 (PDT) Date: Fri, 14 Sep 2007 17:00:59 -0700 From: Leslie Cheung Subject: Re: warmup1 query In-reply-to: Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46EB20BB.7050100@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Someone wrote: > Just had a doubt on "Test client against malicious server #2" in grading guidelines. I get this at the client but the guidelines say it is a long reply by the server. Is there something wrong at the server side or i doing something wrong. > > code=fe11 and length=1301 > hex-value of byte 6 received is 2e > hex-value of byte 7 received is 32 > hex-value of byte 8 received is 32 > hex-value of byte 9 received is 37 > hex-value of byte 10 received is 0 > finished I have just tried... our server is sending a long reply for this ADDR request. You have to think about if you are doing things correctly. For example, what should you do when the server sends you an ADDR reply with a DataLength of 100? --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 16:58:13 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx5.usc.edu (msg-mx5.usc.edu [128.125.137.10]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8ENwDT5018614 for ; Fri, 14 Sep 2007 16:58:13 -0700 Received: from [204.57.0.20] by msg-mx5.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOD007BKUGFM6A0@msg-mx5.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 16:55:27 -0700 (PDT) Date: Fri, 14 Sep 2007 16:55:07 -0700 From: Leslie Cheung Subject: Re: warmup #1 In-reply-to: Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46EB1F5B.8070709@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Someone wrote: > I have 1 query regarding the part below: > Failing auto-shutdown while long transfer in progress : -3 points > ./server -t 10 $port > (then immediately run the following in one or multiple > windows, this should start a long transfer) > ./client -g localhost:$port /home/scf-22/csci551b/public/cali.wav > (see if server exits properly after 10 seconds) > > In this part my server exits after 10 seconds but the client keeps on receiving the data that means the server exited but its still sending the data. So Can I use alarm on client side and exit the client when alarm goes off. > Here, we focus on the behavior of the server. Your server should exit and stop any outstanding data transfer when it shutdowns. > Or Can you suggest me anything else ? What Am I doing wrong because server exits but its still sending data. > I think you are using fork(), and my guess is your child process is not killed when the main process exits. I can't tell for sure because I don't have enough information. > When server exits and when I try to connect to server from another window then my new client do not connect to the server which is perfectly fine. But I believe that as soon as server exits it should stop transferring the data. > It should stop the transfer. > In my catch alarm I am doing this: > void catch_alarm(int sig_num) > { > printf("\n\tTime out. Exiting...\n"); > exit(0); > } > > Again, my guess is your main process exits when it runs the code above, but the child process is still running. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 16:52:08 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx0.usc.edu (msg-mx0.usc.edu [128.125.137.5]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8ENq8Gt018295 for ; Fri, 14 Sep 2007 16:52:08 -0700 Received: from [204.57.0.20] by msg-mx0.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOD00191U69D860@msg-mx0.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 16:49:22 -0700 (PDT) Date: Fri, 14 Sep 2007 16:49:02 -0700 From: Leslie Cheung Subject: Re: about warmup1 In-reply-to: Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46EB1DEE.3060209@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Someone wrote: > I wanted to know 3 thing: > 1) what is required for the readme file? > Things we expect in README are (a) any design decisions you made that is not in the spec (e.g., how do you choose a timeout value, how do you handle malicious clients/servers, etc); (b) Known bugs (not required, but it's nice to have so the grader knows what to expect); (c) any deviation from the spec (e.g., the grader need to type something other than "make server" to create an executable file for the server); and (d) References (e.g., you use some code you find on a web site) Please note that by putting design decisions README does not exempt you from losing points. For example, if you set the timeout value to 2 hours and you put that in README, the grader might think this is not a good decision, and takes points off for those test cases. If you want to put additional info in the README for your own references (e.g., what this project does), that's ok. You can assume that the grader has a copy of the spec, so you don't have to repeat what's in the spec. > 2) what comments are required for the code (is telling what the serveral functions in our program do enough or something more required)? > You should put enough comments so that people can follow your code when they read it briefly. For example, you should put in comments for non-obvious branches (if-else statements with 10 different branches). > 3) what does a log file consist of (what info needs to be logged at the server)? > In warmup1, we have not asked you to do any logging. It's ok to not produce any log files. However, I'd strongly recommend you to put all debugging messages (if you have any) in the log file (instead of printing them on the console). If the grader cannot read your output (because of, for example, there are too many debugging messages), he/she can't tell if it is correct and you will lose point for that. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 01:35:46 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx7.usc.edu (msg-mx7.usc.edu [128.125.137.25]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8E8ZkLX002774 for ; Fri, 14 Sep 2007 01:35:46 -0700 Received: from smtp101.sbc.mail.mud.yahoo.com ([68.142.198.200]) by msg-mx7.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOC00FBVNR2KG50@msg-mx7.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 01:33:03 -0700 (PDT) Received: (qmail 83146 invoked from network); Fri, 14 Sep 2007 08:26:21 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp101.sbc.mail.mud.yahoo.com with SMTP; Fri, 14 Sep 2007 08:26:21 +0000 Date: Fri, 14 Sep 2007 01:25:41 -0700 From: Leslie Cheung Subject: RE: Regarding warmup1 In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOC00FBWNR2KG50@msg-mx7.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf2pJ4LMfTUtwiDQHmSFRtvLwE+PQAAjQAg X-YMail-OSG: f08x13IVM1nsSX9baX1ToYAR_jrUgXGxUS4dWJOD3N3lotTF Someone wrote: > when i am sending the file to the client byte wise, > do i have to send the header in each 512 chunk? No! If your file is 1000 bytes, all you have to do is to send a 6-byte header, followed by the 1000 bytes. You only send the header once. > and here in the data length field, i have to have the actual length of the data carried > in the data field right? For GET requests, the datalength field should be the size of the file. > presently i am just sending the header in the first 512 chunk, with the data length > field contain the size of the entire file. > then i am just sending 512 bytes repeatedly with no header till the entire file is sent. As Dr Cheng said, you have to convince yourself you are doing it right. > also, in the grading guidelines, how are you going to test for ALL_FAIL ? since the > client does not actually print anything for ALL_FAIL.? > Our client program can tell if your server is sending ALL_FAIL. If you go through the grading guidelines, you should see something like "ALL_FAIL received" in the client window when you server send ALL_FAIL to our client. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Fri Sep 14 00:36:06 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=AWL,BAYES_20 autolearn=no version=3.2.0 Received: from msg-mx1.usc.edu (msg-mx1.usc.edu [128.125.137.6]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8E7a6Ee031987 for ; Fri, 14 Sep 2007 00:36:06 -0700 Received: from smtp103.sbc.mail.mud.yahoo.com ([68.142.198.202]) by msg-mx1.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JOC002MDKZN9UE0@msg-mx1.usc.edu> for cs551@merlot.usc.edu; Fri, 14 Sep 2007 00:33:23 -0700 (PDT) Received: (qmail 96407 invoked from network); Fri, 14 Sep 2007 07:33:22 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp103.sbc.mail.mud.yahoo.com with SMTP; Fri, 14 Sep 2007 07:33:22 +0000 Date: Fri, 14 Sep 2007 00:32:42 -0700 From: Leslie Cheung Subject: RE: CSCI551 - using select In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JOC002MEKZN9UE0@msg-mx1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: Acf2mcikFrUNYRhDR5qOZiKTtRLVewABg1Ug X-YMail-OSG: tu0Khe4VM1k0okkSTu6LiwDdulAIBm0Hsri6smPia6QSk_.4 Someone wrote: > I have tried to debug but I am at the point where I don't know what is happening. > > If I am NOT using select and just using recv, I am able to send and receive data. > When I use select(1, &set, NULL, NULL, &tv) where the socket descriptor is the only > one in the set, it always timesout. I am setting the timeout to 100ms. > > The client thread writes the data to the socket, but the server always times-out > waiting for select. > > This is my algorithm, is this correct? > > --set the socket descrp. as the only one in the set > --call select(1, &set, NULL, NULL, &tv) > --check status returned from select > --if status > 0 ==> call recv to read from socket > --else go back and execute select > > Do you have any guidance? You have to convince yourself you are doing things correctly. You should be able to find code sample on the web about select(). I'd suggest you start with some example, and see how select() works. If you need further help, please make an appointment with me. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Thu Sep 13 19:25:30 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_40 autolearn=no version=3.2.0 Received: from msg-mx0.usc.edu (msg-mx0.usc.edu [128.125.137.5]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8E2PUQP013374 for ; Thu, 13 Sep 2007 19:25:30 -0700 Received: from [204.57.0.20] by msg-mx0.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOC00JMQ6M0XU60@msg-mx0.usc.edu> for cs551@merlot.usc.edu; Thu, 13 Sep 2007 19:22:48 -0700 (PDT) Date: Thu, 13 Sep 2007 19:22:30 -0700 From: Leslie Cheung Subject: Re: [csci551]Regarding warmup1 Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46E9F066.5070502@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Someone wrote: > I am facing a problem in 3rd part where server sends byte by byte file > data to client. Sometimes it is received correctly,sometimes some > characters are missing. I dont know what is going wrong, I think there > is some synchronization problem. Say if i send a small file having "hi > how are you" sometimes it is received correctly sometimes only half of > data is received. > It sounds more like a memory issue to me. I would start a debugger and see if anything corrupts the buffer that holds the file. > I paste the code as follows: > Please do not send any code unless you are trying to illustrate an idea. If you need help with debugging, please make an appointment. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Thu Sep 13 19:17:54 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_20 autolearn=no version=3.2.0 Received: from msg-mx5.usc.edu (msg-mx5.usc.edu [128.125.137.10]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8E2HsVW012931 for ; Thu, 13 Sep 2007 19:17:54 -0700 Received: from [204.57.0.20] by msg-mx5.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOC005JT69CSY90@msg-mx5.usc.edu> for cs551@merlot.usc.edu; Thu, 13 Sep 2007 19:15:12 -0700 (PDT) Date: Thu, 13 Sep 2007 19:14:54 -0700 From: Leslie Cheung Subject: Re: Queries regarding Warmup 1 In-reply-to: Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46E9EE9E.50608@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Someone wrote: > Have a confusion with following two points, could you please clarify? > > 1> if we try this command at client side: ./client -a localhost:$port pollux.usc.edu What should be the expected output? > > It should return the IP address of pollux.usc.edu (which you should be able to figure out). > I have my server bound to 68.181.201.3 (IP address of nunki). Even though client is running on nunki, localhost resolves to 127.0.0.1. Hence at this time my client gives an error as I haven't taken any special care to make it work with 127.0.0.1. Do I need to make sure that it works with localhost too? > > You should not bind the server port to a specific IP address. You have to make sure client can send a request to "localhost" as well as "nunki.usc.edu". > 2> Secondly, I am not yet clear with what should happen in case of autoshutdown. > Currently: > I am using FORK() and a child process is forked to handle each client request. > > During a long file transfer, if the SIGALRM signal is received by this child , the child transfers the current byte and exits and at the client I display the error message that > "Server has aborted the file transfer due to server timeout" > > Is it correct? > This is correct. > OR > > The child should transfer the entire file no matter how much more time it takes and then exit even after receiving the SIGALRM signal. In that case the only affect of SIGALRM is that no more new requests are accepted but all other already accepted are served to the completion? > Your server should stop the transfer as soon as it can. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Thu Sep 13 17:09:53 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=no version=3.2.0 Received: from msg-mx0.usc.edu (msg-mx0.usc.edu [128.125.137.5]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8E09r2E004884 for ; Thu, 13 Sep 2007 17:09:53 -0700 Received: from [204.57.0.135] by msg-mx0.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOC00DUY0BZUYF0@msg-mx0.usc.edu> for cs551@merlot.usc.edu; Thu, 13 Sep 2007 17:07:11 -0700 (PDT) Date: Thu, 13 Sep 2007 17:07:12 -0700 From: Leslie Cheung Subject: Re: cs551 auto shutdown help In-reply-to: Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46E9D0B0.10407@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: <46E9AACF.7090009@usc.edu> User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) Someone wrote: > hi, > > Failing kills : -5 points > ./server $port > (then immediately run the following in one or multiple > windows, this should start a long transfer) > ./client -g localhost:$port /home/scf-22/csci551b/public/cali.wav > (press c and see what happens) > (if transfers ends, it's good) > (if transfers continues, start a new client and make sure > the server will refuse to connect) > > In this, Ctrl+C is pressed in the client window right? > this means that the client will exit, but the server will still be listening on its socket, since it is in an infinite while loop. > You should press Ctrl-C in the *server* window. Here, we are killing the server. Once Ctrl-C is pressed, the server should finish up any remaining transfer, and should not accept any new request. > also, > do we really need to use select() for shutdown? > isnt using alarm() and using a signal handler for the SIGALRM enough? > i am still confused as to why exactly select is needed. In warmup1, yes, you can use alarm. We suggest you to use select() so you can get familar with it (select() does more than when alarm does). That's what you will use in the final project. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Thu Sep 13 14:28:34 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx5.usc.edu (msg-mx5.usc.edu [128.125.137.10]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8DLSYvW025511 for ; Thu, 13 Sep 2007 14:28:34 -0700 Received: from [204.57.0.20] by msg-mx5.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JOB000BWSV5TM90@msg-mx5.usc.edu> for cs551@merlot.usc.edu; Thu, 13 Sep 2007 14:25:53 -0700 (PDT) Date: Thu, 13 Sep 2007 14:25:35 -0700 From: Leslie Cheung Subject: cs551 warmup 1 help Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46E9AACF.7090009@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Hi all, If you need any last minute help on warmup1 (especially debugging), feel free to make appointments with me. I am on campus today and tomorrow. I won't be on campus on Sat, but I will be checking my emails. Regards, Leslie Return-Path: lccheung@usc.edu Delivery-Date: Tue Sep 11 17:49:35 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_20 autolearn=no version=3.2.0 Received: from msg-mx5.usc.edu (msg-mx5.usc.edu [128.125.137.10]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8C0nZTZ010139 for ; Tue, 11 Sep 2007 17:49:35 -0700 Received: from [204.57.0.20] by msg-mx5.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTPSA id <0JO800HI6CUF3KE0@msg-mx5.usc.edu> for cs551@merlot.usc.edu; Tue, 11 Sep 2007 17:47:04 -0700 (PDT) Date: Tue, 11 Sep 2007 17:46:48 -0700 From: Leslie Cheung Subject: Re: Fwd: Re: File Size in third part In-reply-to: Sender: lccheung@usc.edu To: cs551@merlot.usc.edu Message-id: <46E736F8.70701@usc.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit References: User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) Someone wrote: > if the file size is 801 bytes then > > 1st Packet : will have 6 bytes header + 506 bytes data > 2nd Packet: will have only 295 remaining bytes and no header > > Could you please confirm if we have to send the header with each and every message? I just saw the message from Professor for similar question (forwarding the same message) and he said this way is not correct. Could you please clarify using the same example above how the packet structure is going to be? Please do *not* think in terms of packets while using TCP. The OS is responsible for adding TCP header, dividing your message into packets, and transporting your TCP packets. You shouldn't have to worry about any of these. TCP is a stream abstraction, and the way to send/receive should be pretty much the same as you read from /write to a file (which is also a stream abstraction). So how do you write a file with the following string as its content? aaaaaabbbbbbbbbbbbbbb Let's assume the string is stored in a variable called "str". You can write the string by calling write() once. write (fd, str, 16); You can first write the a's first (str_a), and then the b's (str_b). write (fd, str_a, 6); write (fd, str_b, 10); You can also write once byte at a time. for (i = 0; i < 16; i++){ write (fd, str[i], 1); } The same idea applies to sending / receiving using TCP. Let's go back to the 801 bytes example. If you have a 6-byte header and 801 bytes of data, how do you send it? Since you are required to send one byte at a time in warmup1, one way to do this is as follows (assuming the var "data" contains both the header and data). for (i = 0; i < 6 + 801; i++){ write (sockfd, data, 1); } But then this violates the buffer size requirement of the spec, since size of data is 807 (> 512) bytes. Now you have to figure out how to use smaller buffers to achieve this. Please note that you are breaking up your data into pieces (I won't call them "packets") because of the buffer size requirement, *not* because of TCP. If there is no buffer size requirement, you can use the code I have above to send 6 bytes of header + 801 bytes of data. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Sep 9 18:08:25 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_50 autolearn=no version=3.2.0 Received: from msg-scanner1.usc.edu (msg-scanner1.usc.edu [128.125.137.19]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l8A18PmJ014564 for ; Sun, 9 Sep 2007 18:08:25 -0700 Received: from smtp104.sbc.mail.mud.yahoo.com ([68.142.198.203]) by msg-scanner1.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JO400MJIOE2TAD0@msg-scanner1.usc.edu> for cs551@merlot.usc.edu; Sun, 09 Sep 2007 18:06:02 -0700 (PDT) Received: (qmail 75637 invoked from network); Mon, 10 Sep 2007 01:05:53 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp104.sbc.mail.mud.yahoo.com with SMTP; Mon, 10 Sep 2007 01:05:53 +0000 Date: Sun, 09 Sep 2007 18:05:25 -0700 From: Leslie Cheung Subject: RE: bad port In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JO400MJJOE2TAD0@msg-scanner1.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: AcfzRLX+7mkK8oPvRhqlInyjo+EYqAAAT+8g X-YMail-OSG: nsJS..sVM1l_CuyY5BwNhb_ZxVdwZfakUIPq73RV6tPX9Q0B Someone wrote: > ./server 80 is bad port. > so can u please tell what is the range of good port nos. > 0-1023 are reserved by the system. > You should only use those ports that are assigned to you. If you were asking about one of the test cases in the bad command line section, your server should quit when it's given a bad port number. --Leslie Return-Path: lccheung@usc.edu Delivery-Date: Sun Sep 9 14:04:21 2007 X-Spam-Checker-Version: SpamAssassin 3.2.0 (2007-05-01) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_50 autolearn=no version=3.2.0 Received: from msg-mx10.usc.edu (msg-mx10.usc.edu [128.125.137.28]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id l89L4LVu007312 for ; Sun, 9 Sep 2007 14:04:21 -0700 Received: from smtp104.sbc.mail.mud.yahoo.com ([68.142.198.203]) by msg-mx10.usc.edu (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with SMTP id <0JO400CPTD3C2450@msg-mx10.usc.edu> for cs551@merlot.usc.edu; Sun, 09 Sep 2007 14:02:00 -0700 (PDT) Received: (qmail 27576 invoked from network); Sun, 09 Sep 2007 21:02:00 +0000 Received: from unknown (HELO lesliea166dd92) (leslieck1014@att.net@75.50.156.169 with login) by smtp104.sbc.mail.mud.yahoo.com with SMTP; Sun, 09 Sep 2007 21:01:59 +0000 Date: Sun, 09 Sep 2007 14:01:32 -0700 From: Leslie Cheung Subject: RE: filesize In-reply-to: To: cs551@merlot.usc.edu Message-id: <0JO400CPUD3C2450@msg-mx10.usc.edu> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Thread-index: AcfzDdeP7CbuAHD3Qf+IOMu4pOdZDAAFmoog X-YMail-OSG: qn8YinEVM1mWBzl.5Ar0tto8p5dJVbi60C7rwThRAEIMkpxT1VOrKX9HvMpuPdWcEQ0- Someone wrote: > How do we get the file size ? > Currently, I am opening the file first using fopen in read mode and then use fseek(), > ftell() to get the file size. > However when I the system is not allowing me to open /etc/shadow file and hence > my server is replying with > FSZ_FAIL. Is there other way to get the file size ? You should use "stat" or "fstat". Please see the man page on nunki on how to use these functions. (Run "man -s 2 stat" on nunki) --Leslie