* Developing a server
@ 2002-04-03 4:19 snodx
2002-04-03 4:39 ` snodx
2002-04-03 13:57 ` Andrea 'Fyre Wyzard' Bocci
0 siblings, 2 replies; 10+ messages in thread
From: snodx @ 2002-04-03 4:19 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Developing a server
2002-04-03 4:19 Developing a server snodx
@ 2002-04-03 4:39 ` snodx
2002-04-03 13:57 ` Andrea 'Fyre Wyzard' Bocci
1 sibling, 0 replies; 10+ messages in thread
From: snodx @ 2002-04-03 4:39 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Developing a server
2002-04-03 4:19 Developing a server snodx
2002-04-03 4:39 ` snodx
@ 2002-04-03 13:57 ` Andrea 'Fyre Wyzard' Bocci
1 sibling, 0 replies; 10+ messages in thread
From: Andrea 'Fyre Wyzard' Bocci @ 2002-04-03 13:57 UTC (permalink / raw)
To: snodx, gcc-help
Well - this is very OFF topic !
This mailing list is devoted to asking and giving help on the use of GCC,
not on C/C++ programming in general !
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Developing a server
2002-04-04 20:43 snodx
@ 2002-04-05 0:56 ` Laurent Pinchart
0 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2002-04-05 0:56 UTC (permalink / raw)
To: gcc-help-return-8516-laurent.pinchart=capflow.com; +Cc: gcc-help
>
>
>For example once I tried to include the netdb.h header file
>in a 'C' program and tried to use several of its functions,
>but at compile time I got several errors.
>
If you posted the exact error message, with a few lines of code, we
might help you.
>This leads me to believe that I have to pass certain compiler
>and linker options while compiling the program, just as
>you do -lvga or -lvgagl while trying to use the vga.h
>header file in a 'C' code.
>
No you don't. The socket API is part of the standard C library, which is
linked by default.
>I am not getting much of documentation on how to
>use GCC. Most of the time I have to rely on the
>mailing list.
>
What about info gcc, or the gcc web page ?
>IF ANYONE CAN POINT OUT A GOOD DOCUMENTATION INCLUDING
>WHAT COMPILER AND LINKER OPTIONS TO PASS WHILE USING
>SPECIFIC HEADER FILES, I promise I wont show my face
>here again unless I am in really serious trouble.
>
No need to shout. If you ask good questions you'll get good answers.
This mailing list is about help on gcc. You are free (and welcome) to
post here if you have a gcc related problem.
>Sorry for the long-winded story here.
>
No problem.
Laurent Pinchart
PS: Read this: http://www.tuxedo.org/~esr/faqs/smart-questions.html (no
offense intended, it's a very helpful document for people who need help
and look for it on mailing lists).
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: Developing a server
@ 2002-04-04 20:57 Thai Dang Vu
0 siblings, 0 replies; 10+ messages in thread
From: Thai Dang Vu @ 2002-04-04 20:57 UTC (permalink / raw)
To: snodx, gcc-help
If you have any trouble, feel free to post it here (even though it's
sometimes a silly question). I'm a newbie in C and C++ (in fact I
learned C very long ago, but I used turbo C 2.0 at that time and I
didn't know anything about the so-called socket ...).
Did you have any example about socket programming with standard C? I saw
some on the Internet.
Hope you and I will progress in C and C++ :)
-----Original Message-----
From: snodx@hotmail.com [mailto:snodx@hotmail.com]
Sent: Friday, April 05, 2002 11:16 AM
To: gcc-help@gcc.gnu.org
Subject: Re: Developing a server
ALRIGHT ALRIGHT ALRIGHT my mistake.
The question I am posting arose because I have
not been successful so far in developing a socket
based C program using GCC.
For example once I tried to include the netdb.h header file
in a 'C' program and tried to use several of its functions,
but at compile time I got several errors.
This leads me to believe that I have to pass certain compiler
and linker options while compiling the program, just as
you do -lvga or -lvgagl while trying to use the vga.h
header file in a 'C' code.
I am not getting much of documentation on how to
use GCC. Most of the time I have to rely on the
mailing list.
IF ANYONE CAN POINT OUT A GOOD DOCUMENTATION INCLUDING
WHAT COMPILER AND LINKER OPTIONS TO PASS WHILE USING
SPECIFIC HEADER FILES, I promise I wont show my face
here again unless I am in really serious trouble.
Sorry for the long-winded story here.
SNODX
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Developing a server
@ 2002-04-04 20:43 snodx
2002-04-05 0:56 ` Laurent Pinchart
0 siblings, 1 reply; 10+ messages in thread
From: snodx @ 2002-04-04 20:43 UTC (permalink / raw)
To: gcc-help
ALRIGHT ALRIGHT ALRIGHT my mistake.
The question I am posting arose because I have
not been successful so far in developing a socket
based C program using GCC.
For example once I tried to include the netdb.h header file
in a 'C' program and tried to use several of its functions,
but at compile time I got several errors.
This leads me to believe that I have to pass certain compiler
and linker options while compiling the program, just as
you do -lvga or -lvgagl while trying to use the vga.h
header file in a 'C' code.
I am not getting much of documentation on how to
use GCC. Most of the time I have to rely on the
mailing list.
IF ANYONE CAN POINT OUT A GOOD DOCUMENTATION INCLUDING
WHAT COMPILER AND LINKER OPTIONS TO PASS WHILE USING
SPECIFIC HEADER FILES, I promise I wont show my face
here again unless I am in really serious trouble.
Sorry for the long-winded story here.
SNODX
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Developing a server
2002-04-03 22:08 snodx
2002-04-04 2:56 ` Laurent Pinchart
2002-04-04 5:56 ` Ish Rattan
@ 2002-04-04 15:06 ` Andrea 'Fyre Wyzard' Bocci
2 siblings, 0 replies; 10+ messages in thread
From: Andrea 'Fyre Wyzard' Bocci @ 2002-04-04 15:06 UTC (permalink / raw)
To: snodx, gcc-help
At 10:24 AM 4/4/02 +0530, snodx@hotmail.com wrote:
>This question is definitely not off-topic.
>It is very much a GNU GCC related question,
>because the set of networking libraries that
>gcc implements is not available in any other
>Linux based C or C++ compiler such as GNU Bison
>or yacc. Only GCC users will be able to tell me
>how to create a socket using the networking
>library header files that come along with GCC.
>
>So eagerly waiting for a positive reply!
> SNODX
I didn't mean to be rude - so I apologize if you perceived me so.
I just wanted to point out that you won't find many help here, because GCC
users are not necessarily network experienced programmers.
From the answers, looks like somebody here at least knows where to point
you, which is IMHO a good starting point.
fwyzard
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Developing a server
2002-04-03 22:08 snodx
2002-04-04 2:56 ` Laurent Pinchart
@ 2002-04-04 5:56 ` Ish Rattan
2002-04-04 15:06 ` Andrea 'Fyre Wyzard' Bocci
2 siblings, 0 replies; 10+ messages in thread
From: Ish Rattan @ 2002-04-04 5:56 UTC (permalink / raw)
To: gcc-help
On Thu, 4 Apr 2002 snodx@hotmail.com wrote:
> This question is definitely not off-topic.
It is AND it was politely pointed out to you.
Try UNIX Network Programming Vol.1 by
W. R. Stevens
for socket based programming..
-ishwar
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Developing a server
2002-04-03 22:08 snodx
@ 2002-04-04 2:56 ` Laurent Pinchart
2002-04-04 5:56 ` Ish Rattan
2002-04-04 15:06 ` Andrea 'Fyre Wyzard' Bocci
2 siblings, 0 replies; 10+ messages in thread
From: Laurent Pinchart @ 2002-04-04 2:56 UTC (permalink / raw)
To: gcc-help-return-8503-laurent.pinchart=capflow.com; +Cc: gcc-help
>
>
>This question is definitely not off-topic.
>
Yes it is.
>It is very much a GNU GCC related question,
>because the set of networking libraries that
>gcc implements is not available in any other
>Linux based C or C++ compiler such as GNU Bison
>or yacc. Only GCC users will be able to tell me
>how to create a socket using the networking
>library header files that come along with GCC.
>
1) GCC does not 'implement' any networking library. You are refering to
the GNU libc, which can be used with other C/C++ compilers.
2) Bison & yacc are not C/C++ compilers.
3) The networking API (Application Programming Interface) that you are
refering to is the BSD socket API. It'sa standard Unix API, and thus any
Unix programmer with a bit of network experience will be able to help
you. Windows uses a different API, but the basic operations (create a
socket, bind it, send and receive data, ...) are performed the same way.
4) For documentation about the BSD socket API, try 'man socket' and read
further.
5) You'll need to implement an HTTP server. Find the HTTP RFC (Request
For Comment) on the web (RFC 1945 for HTTP/1.0), read it, understand it,
and then decide what you want to do.
Laurent Pinchart
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Developing a server
@ 2002-04-03 22:08 snodx
2002-04-04 2:56 ` Laurent Pinchart
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: snodx @ 2002-04-03 22:08 UTC (permalink / raw)
To: gcc-help
This question is definitely not off-topic.
It is very much a GNU GCC related question,
because the set of networking libraries that
gcc implements is not available in any other
Linux based C or C++ compiler such as GNU Bison
or yacc. Only GCC users will be able to tell me
how to create a socket using the networking
library header files that come along with GCC.
So eagerly waiting for a positive reply!
SNODX
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-04-05 7:47 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-03 4:19 Developing a server snodx
2002-04-03 4:39 ` snodx
2002-04-03 13:57 ` Andrea 'Fyre Wyzard' Bocci
2002-04-03 22:08 snodx
2002-04-04 2:56 ` Laurent Pinchart
2002-04-04 5:56 ` Ish Rattan
2002-04-04 15:06 ` Andrea 'Fyre Wyzard' Bocci
2002-04-04 20:43 snodx
2002-04-05 0:56 ` Laurent Pinchart
2002-04-04 20:57 Thai Dang Vu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).