|
From: angel d. <sci...@ho...> - 2007-10-01 03:51:15
|
From: sci...@ho...: pw...@ia...: RE: [D=
ev-C++] Anybody???Date: Sun, 30 Sep 2007 21:49:19 -0600
none of those links works. either: http://ip/image.giforimage.gif doesn't =
work. why?Because, i don't know how to make a www folder using winsock, so =
i can drop images, html source and all that so that the web could be able t=
orequest them successfully. look what i do so that the images can work on t=
he server: This is just an example: (source code isn't real, is just a mode=
l) if( GET \ image.gif HTTP/1.1){ send(image.gif)} If i don't use this,=
when the browser tries to download the image form http://ip/images/the ima=
ge fails. And this is the only output the browsers can send. If only the br=
owser request for all of the imagesthen the server would work very fine. Fo=
r example: if( GET \ image.gif HTTP/1.1){ send(image.gif)} if( GET \ im=
age2.gif HTTP/1.1){ send(image2.gif)} if( GET \ image3.gif HTTP/1.1){ =
send(image3.gif)} I really understand who HTTP works and how servers wor=
k. I just don't know how to make the www folder or the database or whatever=
name is that folder called, so that i can drop files there for the request=
s. To give you an idea, i am building something like IIS.
> Date: Mon, 1 Oct 2007 05:28:16 +0200> From: pw...@ia...> To: sci=
enc...@ho...> CC: dev...@li...> Subje=
ct: Re: [Dev-C++] Anybody???> > Have you read up on the HTTP protocol?> > I=
f your server claim that it users a modern version of the HTTP protocol,> t=
hen most web browsers will issue several requests on the same connect. If> =
you claim that the server only supports standard 1.0, then the browsers> wi=
ll have to make new connects for each request.> > There are no magic involv=
ed with winsock - your problems doesn't have> anything to do with winsock, =
but with understanding the HTTP protocol, and> what a web server is expecte=
d to do.> > A client should not know anything about c:\Dev-Cpp\images - you=
r web> server should have a defined root directory, and should figure out a=
ll> paths either based on that root directory or on individual path> transl=
ations.> > You can also affect what requests the web browser makes by switc=
hing> between absolute, relative and fully qualified image names.> > Some p=
ossible links you might have in the served document:> <a href=3D"http://<ip=
>/images/image1.gif">> <a href=3D"/images/image1.gif">> <a href=3D"images/i=
mage1.gif">> > If you specify a relative path, then the client (the web bro=
wser) must> perform it's request relative to the main document. With an abs=
olute path,> it is enough to use the same connect - or a new connect to the=
same> server. With a fully qualified URL, the web browser may connect to a=
ny web> server to retrieve an image.> > /pwm> > On Sun, 30 Sep 2007, angel =
dario wrote:> > > Have anybody build a server using winsock2 and C++?> >> >=
YES?> > Have you use port 80 to send html data?> >> > YES?> > What did you=
used when the HTML code that you send to the browser had more than 1 pictu=
red?> >> > What did you do when the browser tried to connect to http://your=
ipaddress/image.gif ?????> >> > ...........................................=
...................................> >> > I tried to solve this problem doi=
ng this:> >> > I waited for the browser to ask for the image:> >> > GET /im=
age.gif HTTP/1.1> >> > Then i send it, and it work...> >> > BUT....> >> > S=
ometimes the browser just request for only 1 image, and the rest of the ima=
ges,> > the browser tries to download them, using the path http://youripadd=
ress/> >> > I still can't figure out how browsers can download some data fr=
om servers without sending any request.....> >> > Is there a way, USING WIN=
SOCK2, to let the browser know that http://youripaddress/ is just, C:\Dev-C=
pp\images\?> >> > A source code will help better than a plain answer.> >> >=
_________________________________________________________________> > Conne=
ct to the next generation of MSN Messenger > > http://imagine-msn.com/messe=
nger/launch80/default.aspx?locale=3Den-us&source=3Dwlmailtagline>=20
Connect to the next generation of MSN Messenger Get it now!=20
_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=3Dwindows+vista&mkt=3Den-US&form=3DQBR=
E=
|