1. howto? open, write, read, close an HTTP connection?
You should know better, Pete :). Best practice is to crosspost and set a
followup, that way discussion doesn't get needlessly duplicated. I've set
a followup on this message, but I don't read that group, sorry :)
Okay, so you are writing an HTTP client/HTML UA.
I'm not sure I'm following you; the socket library is at a lower level than
HTTP. You open a TCP connection to port 80 on the server with the sockets,
and read/write at will. If I remember correctly, when using BSD sockets,
you pick the INET family and TCP. Any decent UNIX programming book should
include a bit about sockets.
I'm sure you are looking for code examples, the only one which springs to
mind is libwww, which was bundled with Amaya, and which I haven't looked
at. Presumably, being worked on at W3C, it's a decent implementation.
Bear in mind that most people prefer to work with higher-level languages
when dealing with higher-level protocols like HTTP. Whilst your code might
be ultra-efficient when written in C, the time spent implementing it might
be better used elsewhere.
Also, if you are using Linux, consider farming off the HTTP client bit to
wget or curl; at least for the prototype. If you are worried about the
overhead of starting a new process, I believe most of curl's features are
implemented as part of 'libcurl', which you can link into your executable.
I know perl has adequate HTML parsing routines, but in case your language of
choice does not, consider running the resulting HTML document through tidy
to convert it to xhtml, and just using an xml parser on the end product
(or, of course, the standard grep/sed/awk combinations if you aren't too
fussy about it being a conformant HTML UA).
--
Jim Dabell
2. RH6 -> KDE -> Kvirc ;)
3. can a socket be closed for reading but open for writing?
4. nntpd setup
5. Connection: close HTTP header sent with every request
6. keyboard doesn't work - help!
7. HTTP connections do not close
8. gs, jpeg funny on my ET4000
9. How to open, lock, write and close a file in ksh
10. Apache 2.0 howto write my own http-header
11. Linux sockets problem (closed connections staying open?)
12. Writing a web server. Connection close problem.
13. Close FIFO and open it again to read the remaining data?