• 0

Webserver


Question

Ive written a simple web server for a project. Im having a few problems with it. The data is definatly sent but when it loads in a web browser, the bottom of the page is always missing. which sugguests to me a timing problem? I added a sleep for a second into the server code, after the send is completed. but this results in the browser in either displaying a "Document contains no data" error or a time out error. Im really stumped on this and if anyone could offer any help i would be very grateful.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Are you sure you're receiving ALL of the data? Remember, it's sent in packets (typically 4096 bytes each). You have to keep repeating the receive operation until data stops coming through.

Link to comment
Share on other sites

  • 0

the client is a web browser i.e. firefox, safari, mozilla, i.e. (these are the ones ive tried it on). i seem to have solved the problem by adding a while loop after the send() counting back for 100 to 0. it just adds a delay to the closing of the socket. it seems to work, just wondering if there is a better way?

ive written a simple client to work with the server to test that it does work, and it recieves all of the sent file. its just when i try using a web browser i get this problem

Link to comment
Share on other sites

  • 0

One suggestion I'll give is to install a packet capture program like ethereal. Then you'll be able to see what packets your server is sending out. As for your problem, are you using blocking or non-blocking sockets. If you're using non-blocking, you may be closing the socket before it's done transmitting (is this possible?).

Link to comment
Share on other sites

  • 0

By default, winsock1 functions block, but winsock2 functions can do both by using the OVERLAPPED param. At least on win32 this is true.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.