I wrote a very, very basic web server a while ago (there was a Reddit programming challenge to do so). I'd be embarrassed to show all of my code for it, but I can tell you that the response back to the client browser needs specific header information.
For an HTML Page, this is what should be sent to the client:
So, this is an example of some code from my program. It determines the file extension of the file being requested and assigns an appropriate header for a few basic types:Code:HTTP/1.0 200 OK Content-type: text/html <html>Hello</html>
After that, I read in the contents of the file being requested and append those contents to the strOutData variable and then when that is done just do aCode:Select Case pstrExt Case "jpg", "jpeg" pstrContentType = "Content-type: image/jpeg" Case "gif" pstrContentType = "Content-type: image/gif" Case "htm", "html" pstrContentType = "Content-type: text/html" Case Else pstrContentType = "Content-type: */*" End Select strOutData = "HTTP/1.0 200 OK" & vbCrLf & _ pstrContentType & vbCrLf & vbCrLf
Code:wsockWeb.SendData strOutData




Reply With Quote
