|
From: Per W. <pw...@ia...> - 2007-10-01 03:28:33
|
Have you read up on the HTTP protocol? If your server claim that it users a modern version of the HTTP protocol, then 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 will have to make new connects for each request. There are no magic involved with winsock - your problems doesn't have anything to do with winsock, but with understanding the HTTP protocol, and what a web server is expected to do. A client should not know anything about c:\Dev-Cpp\images - your web server should have a defined root directory, and should figure out all paths either based on that root directory or on individual path translations. You can also affect what requests the web browser makes by switching between absolute, relative and fully qualified image names. Some possible 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/image1.gif"> If you specify a relative path, then the client (the web browser) must perform it's request relative to the main document. With an absolute 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 any 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 mor= e than 1 pictured? > > What did you do when the browser tried to connect to http://youripaddress= /image.gif ????? > > .........................................................................= =2E.... > > I tried to solve this problem doing this: > > I waited for the browser to ask for the image: > > GET /image.gif HTTP/1.1 > > Then i send it, and it work... > > BUT.... > > Sometimes the browser just request for only 1 image, and the rest of the = images, > the browser tries to download them, using the path http://youripaddress/ > > I still can't figure out how browsers can download some data from servers= without sending any request..... > > Is there a way, USING WINSOCK2, to let the browser know that http://youri= paddress/ is just, C:\Dev-Cpp\images\? > > A source code will help better than a plain answer. > > _________________________________________________________________ > Connect to the next generation of MSN Messenger=A0 > http://imagine-msn.com/messenger/launch80/default.aspx?locale=3Den-us&sou= rce=3Dwlmailtagline |