r/learnprogramming • u/GuanoTail • May 27 '11
Help with getting into network programming? [C]
I recently started gaining an interest in network programming while using C. I was given an assignment by a mentor to write a program that would use an HTTP GET request on HTTP 1.0.
Let me make this clear, I am NOT asking for direct code to use. In fact, if you gave working code, I would down vote you. What I do want is articles, tutorials, general information on the subject.
I don't know much about socket programming, but if someone could tell me the concept of making an HTTP GET request I would be thankful.
I am working on Ubuntu compiling with gcc, and I was told to use the Berkeley headers.
Which functions should I look into using for performing the HTTP GET request?
8
u/defrost May 27 '11
Socket and network programming resources:
Beej guide to networking.
Books by W. Richard Stevens.
Kegel exercises: The C10K problem.
3
u/dmazzoni May 27 '11
You basically need to learn two things:
2
u/miyakohouou May 27 '11
defrost's comment has you covered for socket related code. For the HTTP part, if you want in-depth documentation, check out the RFCs for HTTP/1.0 and HTTP/1.1. They are good to read, and will give you an overview of the protocol. More practically, you might also want to write a simple html page that submits a form via a get request, then use wireshark or tcpdump to watch the traffic so you can see how the requests are actually implemented.