18F87J50 as a webserver


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425

    Default Re: 18F87J50 as a webserver

    Agmen, can you help me a little more. I've been trying get the web server to work but I'm having no success. I'm confused about a few things so I stripped all of the features out of the code and went with something very simple.

    I'm trying to use this code:
    Code:
     IF MESSAGE1[0]="G" AND MESSAGE1[1]="E" AND MESSAGE1[2]="T" THEN 
                 LCDOUT $FE, 192, "SERVER HIT!"
                 HIGH LED1G
                 HIGH LED2G
                 HIGH LED3G
                 HSEROUT [13,13]
                   HSEROUT["<HTTP/1.0 200 OK Content-Length: 800>",13]
          HSEROUT ["Content-Type: text/html",13]
          hserout [13]
              hserout ["<html>",13]
              hserout ["<head>Test page</head>",13]
              HSEROUT ["<body>This is a test page</body>",13]
               hserout ["</html>",13]
                HSEROUT [13,13]
                PAUSE 500
    Why doesn't this work? When I pull it up on a webpage, it doesn't work correctly. When I use "0,0,0" at the end, the webpage acts like it wants to download a file. Can you point me in the right direction?

  2. #2

    Default Re: 18F87J50 as a webserver

    hi,
    My best understanding (and not real clear), the HTTP stuff uses the "Content-Length: ???" to give the html stuff the right amount of bytes then close the connection and render the page.
    Try to figure what would be the correct 'Content-Length: ' and/or send at least that many serial bytes in 'Content-Length:???'.
    and please share technical info of successes and failures.
    I have been trying to keep up with web stuff, I think things get more straight forward as they evolve...... like HTML5
    Seems like there should have been a command to "render page now" in html, but I could not find one for that in much google search.
    don

  3. #3
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425

    Default Re: 18F87J50 as a webserver

    Quote Originally Posted by amgen View Post
    hi,
    Try to figure what would be the correct 'Content-Length: ' and/or send at least that many serial bytes in 'Content-Length:???'.
    and please share technical info of successes and failures.
    Will do. One additional question. Why don't you have this line of code:
    Code:
    "HTTP/1.0 200 OK",13,"Content-Length: 800 ",13,13
    written like this:
    Code:
    "<HTTP/1.0 200 OK",13,"Content-Length: 800>",13,13

  4. #4

    Default Re: 18F87J50 as a webserver

    there is a blank line required separating the HTTP header and html code.
    I don't remember exactly what web, but search for HTTP explained has more info.....tons of info....too much info !!
    good luck

Similar Threads

  1. Webserver with PIC18F67J60
    By Gevo in forum Ethernet
    Replies: 0
    Last Post: - 25th May 2011, 07:03
  2. Serial over Ethernet - Webserver
    By malc-c in forum Ethernet
    Replies: 9
    Last Post: - 29th April 2010, 08:03
  3. Serial over Ethernet - Webserver
    By malc-c in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th April 2010, 08:03
  4. PBP TCP/IP stack and Webserver
    By rocketman in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 11th July 2005, 22:30
  5. How made a webserver wit a pic
    By NL2TTL in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th September 2004, 04:55

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts