Re: bsd sockets & http
Re: bsd sockets & http
- Subject: Re: bsd sockets & http
- From: "Philip D. Wasson" <email@hidden>
- Date: Fri, 19 Jul 2002 18:57:16 -0400
On Wednesday, July 17, 2002, at 11:54 , Chaz wrote:
I'm currently reading up on bsd sockets and I've run into a problem
while trying to make a sample http client. Here's what I've done:
socket()
bind() // to a random port - i don't think this is necessary for an
http client, but to my knowledge it shouldn't hurt.
connect() // to the http server on port 80
.
.
.
} // Might be a weird way to do this, but it is a sample after all.
The message sent is "GET /" which works in telnet.
read() // similarly to how I sent, making sure all the data has
arrived. But no data ever does arrive.
close()
I don't know HTTP, so I can't add any detail to Jens Bauer's comment
about sending the right HTTP header. Except I wonder if you sent a CR/LF
at the end of the request. I'm pretty sure HTTP likes there to be a
specific kind of line ending.
Oh, and you don't need the bind(). Better to skip it and have one less
possible error to deal with.
----------------------------------------
Philip D. Wasson
Senior Software Engineer
Managing Editor Inc.
email@hidden
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.