473,399 Members | 3,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How To Use C To Write A Web Server?

Hi,

I just start learning network programming. How can I write a web server
with
"C" so that it can connect to web browser and read the request, accept the
request,
open requested html page, send it back to the web browser for user
viewing.

One more is how can i allow multi-users send request to the web server?

if possible, Could you post sample code?
Thank you!
Nov 14 '05 #1
5 5061
searcher1234 wrote:
Hi,

I just start learning network programming. How can I write a web server
with
"C" so that it can connect to web browser and read the request, accept the
request,
open requested html page, send it back to the web browser for user
viewing.

One more is how can i allow multi-users send request to the web server?

if possible, Could you post sample code?


You can do it by using platform specific extensions.

Please post to a newsgroup specific to your particular platform.

HTH,
--ag

--
Artie Gold -- Austin, Texas

"If you don't think it matters, you're not paying attention."
Nov 14 '05 #2
>I just start learning network programming. How can I write a web server

Network programming is outside the scope of standard C.
You may want comp.unix.programmer .
with
"C" so that it can connect to web browser and read the request, accept the
request,
open requested html page, send it back to the web browser for user
viewing.

One more is how can i allow multi-users send request to the web server?
Multiple processes and/or threads are also outside the scope
of standard C.
if possible, Could you post sample code?


Apache is an open-source web server. http://www.apache.org/

Gordon L. Burditt
Nov 14 '05 #3
searcher1234 wrote:

I just start learning network programming. How can I write a web
server with "C" so that it can connect to web browser and read the
request, accept the request, open requested html page, send it
back to the web browser for user viewing.

One more is how can i allow multi-users send request to the web
server?

if possible, Could you post sample code?


Sure:

int main(int argc, char **argv)
{
abrowser brow;
arequest request;

if (validateargs(argc, argv) {
brow = openbrowser(argv[1]);
while (request = getrequest(brow)) {
view(open_page(request));
}
}
return 0;
}

should do it, once you flesh it out with a few #includes, data
definitions, functions, etc.

--
"I support the Red Sox and any team that beats the Yankees"
"Any baby snookums can be a Yankee fan, it takes real moral
fiber to be a Red Sox fan" - "I listened to Toronto come back
from 3:0 in '42, I watched Boston come back from 3:0 in '04"
Nov 14 '05 #5

In article <2t*************@uni-berlin.de>, Artie Gold <ar*******@austin.rr.com> writes:
searcher1234 wrote:
I just start learning network programming. How can I write a web server
with
"C" so that it can connect to web browser and read the request, accept the
request,
open requested html page, send it back to the web browser for user
viewing.
You can do it by using platform specific extensions.


Not even then, since web browsers, as a rule, do not accept inbound
connections. Now, if the OP wanted to write a server that accepted
a connection from a browser, that would merely be off-topic.
Please post to a newsgroup specific to your particular platform.


I'd recommend comp.protocols.tcp-ip, where the relevant protocols and
some of the relevant APIs and techniques are discussed, and
comp.infosystems.www.servers.misc, which covers this topic in general,
but my feeling is the OP is nowhere near ready to tackle building an
HTTP server.

Writing an HTTP server from scratch is a non-trivial task. I suggest
the OP consult the FAQs for the groups above to learn where to go to
learn what's involved.

--
Michael Wojcik mi************@microfocus.com

Thanks for your prompt reply and thanks for your invitatin to your
paradise. Based on Buddihism transmigration, I realize you, European,
might be a philanthropist in previous life!
-- supplied by Stacy Vickers
Nov 14 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Zed | last post by:
I have a problem with .net writing to a remote server that I need to deploy on. The app works fine on my local machine. But when got access to the server I went to VS.NET and tried to create a...
11
by: Michael Powe | last post by:
How can I make an XHTML-compliant form of an expression in this format: document.write("<scr"+"ipt type='text/javascript' src='path/to/file.js'>"+"</scr"+"ipt>"); this turns out to be a...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
4
by: cbtechlists | last post by:
I have an ASP app that we've moved from a Windows 2000 to a Windows 2003 server (sql server 2000 to sql server 2005). The job runs fine on the old servers. Part of the app takes a recordset and...
3
by: Brett_A | last post by:
I'm trying to write data from a form using a text box (textarea) that has a return after each item. For example: email1@domain.com email2@domain.com email3@domain.com email4@domain.com I'm...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
4
by: Ross | last post by:
Hello, I am trying to Read and Write to a text file on a web server using Microsoft Visual Basic 2005 Express Edition. So far I have managed to complete my testing with a local text file using...
0
by: kuguy | last post by:
Hi all, I'm new to the forums, so I hope this isn't in the wrong place... I have that "Software caused connection abort: socket write error" exception error that i've never meet before. ...
7
by: Jim in Arizona | last post by:
I'm brand new at ajax. In fact, about 20 minutes ago was the first time I got it to work. The problem I'm having on another page did not work, however. I'm running into the following error: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.