From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29637 invoked by alias); 3 Apr 2002 12:19:51 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 29267 invoked from network); 3 Apr 2002 12:16:51 -0000 Received: from unknown (HELO relay.spectranet.com) (203.122.63.157) by sources.redhat.com with SMTP; 3 Apr 2002 12:16:51 -0000 Received: from COMPUTER4 ([203.122.42.109]) by relay.spectranet.com (8.11.2/8.11.2) with ESMTP id g33C6g727102 for ; Wed, 3 Apr 2002 17:36:43 +0530 Date: Wed, 03 Apr 2002 04:19:00 -0000 Message-ID: <4916061.1017836729628.JavaMail.Administrator@COMPUTER4> From: snodx@hotmail.com To: gcc-help@gcc.gnu.org Subject: Developing a server Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-SW-Source: 2002-04/txt/msg00020.txt.bz2 Greetings, I searched in the help-gcc list to check whether this question has already been posted before, but I am getting too many results! I wish to develop a server. The architecture of the server that I have in mind is quiet complex. Here is a pruned-down concept of that server: The server is to be written in C Or C++ and will run on Linux The server should accept requests for serving files with the extension .sno (dot sno). The server should listen for requests only on port 100 When the server gets a request for a .sno file it should check in a particular directory (for namesake I will call this directory as DocumentRoot) whether this .sno file exists there or not. If the file exists then it should check whether there is ANY character, ANY byte written onto the file or not. If there is it should display "HURRAH" and if the file is totally empty (zero byte in size) the server should display "APOLOGIES". So thus this is the basic functioning I am trying to achieve: ----------------------------------------------------------------------------- ____________ | MY SERVER| IF REQUEST FOR .SNO FILE THEN DIRECT REQUEST TO SERVER ____________ | LISTENING|___//____________________________________________________________________| NETSCAPE | | AT PORT | \\ | NAVIGATOR| | 100 | | OR | |__________| | LYNX | | |__________| | | | | \|/ | | | \|/ | | | | /|\ | | | CHECKING WHETHER /|\ | | | .SNO FILE EXISTS /\ | | | | INSIDE DOCUMENTROOT / \ | | | | DIRECTORY OR NOT / \ SEND RESULT STRING "URL test.sno does not exist" | | | |_______________\\______/ NO \___________\\____________________________________| | | | // \ / // | | | \ / | | | \ / | | | \/ | | \|/ /|\ | \|/ /|\ | | | | /\ | | / \ | | / \ | | / YES \ | | \ / | | \ / | | \ / | | \/ | | | | | | CHECKING WHETHER | | \|/ FILE HAS SOME /\ | | \|/ OR NOT / \ | | | / \ SEND STRING "APOLOGIES" | | |_________\\______ _/ NO \___________\\____________________________________________| | | // \ / // | | \ / /|\ | \ / /|\ /\ \/ | / \ SEND STRING "HURRAH" | / YES\_________\\____________________________________________________\\____________________| \ / // // \ / \/ ----------------------------------------------------------------------------- The server is run in a Linux box (a Linux command terminal). I open Netscape Navigator or Lynx and type http://localhost:100/test.sno The browser should check whether a server is listening with the name localhost at port 100. The browser should be able to detect my server program running in the background. Once the browser does so it should pass on the request test.sno to my server. If the file test.sno DOES NOT EXIST then the message "URL test.sno does not exist" should be displayed in Netscape or Lynx. If the file does exist then it is to be checked whether the file is empty or not. If empty then the message "APOLOGIES" should be displayed in Netscape (or Lynx). Else if the file is not empty then the string "HURRAH" -------------------------------------------------------------------------------------- I can understand that these are the basic elemnts that I am supposed to incorporate (but I dont have an idea how to go about it): A socket which listens at port 100 A FILE object which checks for existence of the requested file and for the contents in the file. Any help would be appreciated. I did go through certain open source server software such as Apache, but the program was too complex for me to understand. Eagerly awaiting a reply. SNODX From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32232 invoked by alias); 3 Apr 2002 12:32:23 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 32209 invoked from network); 3 Apr 2002 12:32:14 -0000 Received: from unknown (HELO relay.spectranet.com) (203.122.63.157) by sources.redhat.com with SMTP; 3 Apr 2002 12:32:14 -0000 Received: from COMPUTER4 ([203.122.42.109]) by relay.spectranet.com (8.11.2/8.11.2) with ESMTP id g33C6g727102 for ; Wed, 3 Apr 2002 17:36:43 +0530 Date: Wed, 03 Apr 2002 04:39:00 -0000 Message-ID: <4916061.1017836729628.JavaMail.Administrator@COMPUTER4> From: snodx@hotmail.com To: gcc-help@gcc.gnu.org Subject: Developing a server Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-SW-Source: 2002-04/txt/msg00021.txt.bz2 Message-ID: <20020403043900.prU4uJH41Z3VE4cHGBgqdjjaNbbLYx35ZDKfuxFDfaE@z> Greetings, I searched in the help-gcc list to check whether this question has already been posted before, but I am getting too many results! I wish to develop a server. The architecture of the server that I have in mind is quiet complex. Here is a pruned-down concept of that server: The server is to be written in C Or C++ and will run on Linux The server should accept requests for serving files with the extension .sno (dot sno). The server should listen for requests only on port 100 When the server gets a request for a .sno file it should check in a particular directory (for namesake I will call this directory as DocumentRoot) whether this .sno file exists there or not. If the file exists then it should check whether there is ANY character, ANY byte written onto the file or not. If there is it should display "HURRAH" and if the file is totally empty (zero byte in size) the server should display "APOLOGIES". So thus this is the basic functioning I am trying to achieve: ----------------------------------------------------------------------------- ____________ | MY SERVER| IF REQUEST FOR .SNO FILE THEN DIRECT REQUEST TO SERVER ____________ | LISTENING|___//____________________________________________________________________| NETSCAPE | | AT PORT | \\ | NAVIGATOR| | 100 | | OR | |__________| | LYNX | | |__________| | | | | \|/ | | | \|/ | | | | /|\ | | | CHECKING WHETHER /|\ | | | .SNO FILE EXISTS /\ | | | | INSIDE DOCUMENTROOT / \ | | | | DIRECTORY OR NOT / \ SEND RESULT STRING "URL test.sno does not exist" | | | |_______________\\______/ NO \___________\\____________________________________| | | | // \ / // | | | \ / | | | \ / | | | \/ | | \|/ /|\ | \|/ /|\ | | | | /\ | | / \ | | / \ | | / YES \ | | \ / | | \ / | | \ / | | \/ | | | | | | CHECKING WHETHER | | \|/ FILE HAS SOME /\ | | \|/ OR NOT / \ | | | / \ SEND STRING "APOLOGIES" | | |_________\\______ _/ NO \___________\\____________________________________________| | | // \ / // | | \ / /|\ | \ / /|\ /\ \/ | / \ SEND STRING "HURRAH" | / YES\_________\\____________________________________________________\\____________________| \ / // // \ / \/ ----------------------------------------------------------------------------- The server is run in a Linux box (a Linux command terminal). I open Netscape Navigator or Lynx and type http://localhost:100/test.sno The browser should check whether a server is listening with the name localhost at port 100. The browser should be able to detect my server program running in the background. Once the browser does so it should pass on the request test.sno to my server. If the file test.sno DOES NOT EXIST then the message "URL test.sno does not exist" should be displayed in Netscape or Lynx. If the file does exist then it is to be checked whether the file is empty or not. If empty then the message "APOLOGIES" should be displayed in Netscape (or Lynx). Else if the file is not empty then the string "HURRAH" -------------------------------------------------------------------------------------- I can understand that these are the basic elemnts that I am supposed to incorporate (but I dont have an idea how to go about it): A socket which listens at port 100 A FILE object which checks for existence of the requested file and for the contents in the file. Any help would be appreciated. I did go through certain open source server software such as Apache, but the program was too complex for me to understand. Eagerly awaiting a reply. SNODX