LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 01-22-2006, 06:09 AM   #1
mehro
LQ Newbie
 
Registered: Sep 2005
Location: Pakistan
Posts: 19

Rep: Reputation: 0
reqest for html page from server


i want a c code through which i send a reqest to the server for a html page page to server made socket connection but dont know how to request for a html page.
 
Old 01-22-2006, 11:04 PM   #2
StevenO
Member
 
Registered: Jan 2006
Distribution: Slackware 10.2
Posts: 45

Rep: Reputation: 15
Hmm. But there's the "wget" cmd which will allow you to retrieve webpages from web server. Does that achieve your objective?
 
Old 01-23-2006, 06:51 AM   #3
mehro
LQ Newbie
 
Registered: Sep 2005
Location: Pakistan
Posts: 19

Original Poster
Rep: Reputation: 0
anything other then wget

i have to request for html file from my client to the server ,i have connectivity code but dont know how to send request for html file ,i need code in c,while i am using redhat 9.
 
Old 01-23-2006, 08:37 PM   #4
carl.waldbieser
Member
 
Registered: Jun 2005
Location: Pennsylvania
Distribution: Kubuntu
Posts: 197

Rep: Reputation: 32
Quote:
Originally Posted by mehro
i have to request for html file from my client to the server ,i have connectivity code but dont know how to send request for html file ,i need code in c,while i am using redhat 9.
Although it is a lot easier using tools like wget, curl, etc., you can do it "from scratch" in C by opening a connection to port 80 on the server and sending the appropriate "GET" request. Here is a link to the HTTP 1.1 protocol RFC:
http://www.rfc-editor.org/rfc/rfc2616.txt

Note that if you can use libraries with your code, you could use something like libcurl http://curl.haxx.se/libcurl/ to make the coding a lot simpler.

If you are going to try it from scratch, I would suggest you experiment first with something like Python's socket module or netcat (nc) in order to get a feel for what is actually going on. Or watch what your browser sends a server and what gets send back with a tool like ethereal.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
html-page timestamp? linmix Linux - General 3 12-25-2005 04:39 PM
Apache2 no index.html page babelbrennt Debian 1 11-10-2005 07:35 AM
html page maker prabhakar_kushwaha Linux - Software 3 10-14-2005 09:17 PM
I cant change the default test page in apache server to add my page.y nhemapriya Linux - Newbie 3 05-13-2004 12:35 PM
HTML page break? patpawlowski Programming 4 02-12-2004 10:30 AM


All times are GMT -5. The time now is 01:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration