help in Linux Sockets
hello every body :)
i need some help in linux sockets how i can read text files remotely like this Code:
http://www.linuxquestions.org/textfile.txt thnx 4 all |
Code:
exec 3<>/dev/tcp/www.linuxquestions.org/80 |
Quote:
i need the answer in c language Quote:
thanks for replay |
|
Actually, for just sending text to a web browser, you don't even need to touch the HTTP protocol. Just dump a pre-determined text file back to the client upon connection. But it won't hurt to study other higher level protocols after you get the hang of sockets.
|
But he(?) whishes to request a file from a http server, therefore the request would look something like this:
Quote:
Code:
$ telnet www.google.co.uk 80 |
*SMACKS HEAD*
Yep, missed that, that'll teach me to answer questions when tired. Still quite simple either way. |
thanx for all
but i need any examples or any tutorials to understand Dealing linux sockets with http in c thanx again |
That first example I gave you shows examples of tcp/ip connections, the second (+ other posts) show examples of the http protocol. Basically after connecting to the server, the only difference is the commands sent, i.e. send a 'GET' command and it shall be served... It's easier than you think... The telnet example can be used as a client for virtually any protocol, so you might like to start with that?
|
I strongly recommend Beej's Guide, as pointed out by a previous poster, for a bunch of very good examples and good tutorial text.
--- rod. |
All times are GMT -5. The time now is 01:24 PM. |