Shop OBEX P1 Docs P2 Docs Learn Events
It's Alive!!...or should I say...It's Online!! — Parallax Forums

It's Alive!!...or should I say...It's Online!!

CassLanCassLan Posts: 586
edited 2010-12-07 18:29 in Accessories
It was surprisingly easy to get it serving a simple modified version of Tim's Web Page Demo.

http://spinneret.cassidydevelopment.net/


Rick
«1

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-11-19 14:16
    @Rick,

    Any chance you can post your code, I'm struggling with it here.

    OBC
  • CassLanCassLan Posts: 586
    edited 2010-11-19 14:25
    Oh Sure man, I didn't change much from the demo, thats why I didn't post it.

    I just changed MAC / IP Settings / Port # (See Pic)

    Also I changed the HTML (See Pic)
  • BeanBean Posts: 8,129
    edited 2010-11-19 14:34
    I already have code to parse the URL to support METHOD="GET" form inputs.

    I haven't fully tested it yet, but it seems to work.

    Use at your own peril.

    All your inputs must be named "0" thru "9". Then use the VarExists[] and VarStr[] arrays to access them.

    Bean
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-11-19 15:03
    Can you guys see if I'm configured right?

    http://74.5.62.253

    Thanks!

    OBC
  • CassLanCassLan Posts: 586
    edited 2010-11-19 15:03
    @Bean: Sweet I'll give it try!
  • CassLanCassLan Posts: 586
    edited 2010-11-19 15:04
    @OBC: Not getting to it just yet. did you forward port 80, or use a different port?
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-11-19 15:10
    Should be port 80..

    OBC
  • zapmasterzapmaster Posts: 54
    edited 2010-11-19 15:56
    yea me to the demo works!!
  • CassLanCassLan Posts: 586
    edited 2010-11-19 15:59
    Jeff I tried to send you a couple of PM's, but in PM's sent folder it says I have sent: 0

    Anyway, many ISP's block serving on Port 80, try a different port.
  • CassLanCassLan Posts: 586
    edited 2010-11-19 16:06
    @Bean - Thats really sweet, thank you for such a great starting point!
  • CassLanCassLan Posts: 586
    edited 2010-11-19 16:50
    @Bean - Ok so if I'm reading your code correctly, the URL is located in the data[] buffer? This is where your parsing your inputs from.

    In effect, this would also be where a filename would be placed...ie "blah.com\index.htm"..etc

    So, this would be the first place to start to serve a specific file from the SDCard?
  • Roy ElthamRoy Eltham Posts: 2,996
    edited 2010-11-19 17:00
    I have code that processes the GET requests and serves the files from the SD card. It's at home and I am at work still, or I would post it now.

    We have some limitations because we can't easily support long file names on the SD card when we use FAT format. I just made all of my web page files fit in the 8.3 length with all caps, and it works fine so far.

    My code also uses my DHCP code to get the IP/gateway/subnetmask info, so the only thing you need to do is set the MAC address and load appropriate files into the SDcard.

    I was going to look at replacing my simple GET request parsing with whatever Bean has provided. I just haven't been home yet to take a look.
  • schillschill Posts: 741
    edited 2010-11-19 17:44
    Roy Eltham wrote: »
    My code also uses my DHCP code to get the IP/gateway/subnetmask info, so the only thing you need to do is set the MAC address and load appropriate files into the SDcard.

    Maybe we should consider using a standard file on the SD card to hold MAC address and any other required network-related properties. That way, the programs would not have to be changed on a user-by-user basis. And everyone's application could look for the same file which (I hope) would be less confusing.

    Call it something like address.txt . It can be a standard text file. The first line could contain the MAC address. The second line could contain an IP address or be blank or contain "DHCP" or something similar to indicate it should use DHCP. This way, you set a specific IP if you need on (which is good for web servers, certain control issues, etc.).
  • BeanBean Posts: 8,129
    edited 2010-11-19 17:56
    @CassLan, Yeah the filename would be in the beginning part. I'll modify my code to parse that out too. Right now it just skips it.

    I also want to work on code to do METHOD="POST".

    Bean
  • BeanBean Posts: 8,129
    edited 2010-11-19 18:52
    Could someone do a favor and see if you can see my Spinneret from the outside.

    173.67.187.91

    Should see a page titled "Bean's Hardware Web Server". If it doesn't work, that means fios is blocking my port 80 and I'll have to pick a different port. You should see a checkbox next to the word "LED", if you would check that checkbox and press the submit button, I can check to see if it cames on.

    Thanks, and let me know ASAP.

    Bean
  • Bob Lawrence (VE1RLL)Bob Lawrence (VE1RLL) Posts: 1,720
    edited 2010-11-19 19:22
    Bean,

    Re: I read you loud and clear in Nova Scotia , Canada :)


    ===================================
    Bean's Hardware Web Server

    This is a test from Bean's Hardware Web Server.
    LED OFF
    Filename is
    LED:


    Response after I submitted:

    Bean's Hardware Web Server

    This is a test from Bean's Hardware Web Server.
    LED ON
    Hello Bob from Halifax%2CNS. Canada
    Filename is
    LED:
    Name:
    City:

    Name:
    City:
  • BeanBean Posts: 8,129
    edited 2010-11-19 19:28
    <in my best evil scientist voice> EXXXXCILENT

    Bob, Thanks alot. I had heard that FiOS had opened up port 80. I guess they did.

    Bean
  • $WMc%$WMc% Posts: 1,884
    edited 2010-11-19 20:15
    Bean wrote: »
    Could someone do a favor and see if you can see my Spinneret from the outside.

    173.67.187.91

    Should see a page titled "Bean's Hardware Web Server". If it doesn't work, that means fios is blocking my port 80 and I'll have to pick a different port. You should see a checkbox next to the word "LED", if you would check that checkbox and press the submit button, I can check to see if it cames on.

    Thanks, and let me know ASAP.

    Bean
    '
    Bean:
    '
    I can get to Your Bean's Hardware Web Server
    '
    This is really cool if it is coming from Your Spinneret!
    1212 x 884 - 58K
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-11-19 21:56
    Yes, the code really works!

    (At least on my internal network.) --

    OBC
  • BeanBean Posts: 8,129
    edited 2010-11-20 08:02
    I made a new thead with the offical version of the GET code.
    http://forums.parallax.com/showthread.php?p=955499#post955499

    It now handles symbols correctly.

    Bean
  • Duane DegnDuane Degn Posts: 10,588
    edited 2010-11-24 09:33
    I'm trying out Bean's code. Can anyone see my Spinneret? It should be at http://192.168.10.20

    Thanks everyone for sharing all your efforts. I'll make sure and post any useful additions I might make (I'd like to stress the "might" part).

    I'll probably enter the contest mainly to get feedback from all of you.

    Okay, I'm now in "watching the LED" mode.

    Duane
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-11-24 09:39
    I'm not seeing it. :(

    Do you have "forwarding" setup in your router?

    OBC
  • Duane DegnDuane Degn Posts: 10,588
    edited 2010-11-24 09:39
    Okay, I saw the LED turn on. Where you able to fill out the form?

    Edit: OBC our posts crossed paths.
  • obrienmobrienm Posts: 65
    edited 2010-11-24 09:46
    Duane,
    Welcome, could you post the IP of your WAN router, the 192.168.0 subnet is your internal network - all of the 4 numbers should be different than the reserved subnet above. I'll try your embedded server then.
    After you either do port forwarding for port 80 or a DMZ goto the following or your routers' admin page to get the IP.

    http://www.whatismyip.com/

    For example I am running on 192.168.194 but my corp wan IP shows as 148.*7.*7.**5
    thank you
    /michael
  • Duane DegnDuane Degn Posts: 10,588
    edited 2010-11-24 09:47
    OBC, I thought I set up Port forwarding correctly with the Router. I used HTTP as the service and entered the same IP there as gave here. I increased the last digit of the IP my computer uses by 17.

    I changed the sections of Bean's code where ever he had
    !!! CHANGE TO MATCH YOUR NETWORK !!!

    I can access it from my computer. Of course it's connected to the same router so that doesn't tell me much.

    I'll have another look. Thanks for trying.

    Duane
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-11-24 09:47
    Oops! Missed that!

    Yes, you do need to setup forwarding, then provide your "external" ip address. You can find it at http://www.whatismyip.com

    OBC
  • Duane DegnDuane Degn Posts: 10,588
    edited 2010-11-24 09:56
    Under WAN setup I see a check next to
    Connect Automatically, as Required
    I think I have some more reading to do. I check back when I'm ready for another try. Thanks.

    I just saw OBC's post thanks.

    Duane
  • BeanBean Posts: 8,129
    edited 2010-11-24 10:25
    Duane,

    If you go into your router's configuration there should be s section called "Port Forwarding".

    Go into that and set port 80 to go to your spinneret's IP address.

    That should be all you have to do aside from giving us your router's internet IP address instead of any local address. 192.168.x.x is local.

    Let us know when you get the port forwarding done and we'll try it again.

    Bean
  • Duane DegnDuane Degn Posts: 10,588
    edited 2010-11-24 10:31
    Apparently my IP is 71.221.138.84

    I'm unsure what to change in this part of Bean's code.
      SetMAC($00, $08, $DC, $16, $EF, $08) ' !!! CHANGE TO MATCH YOUR NETWORK !!!
        ' I entered this from the bottom of the Spinneret.
     
      SetGateway(192, 168, 10, 20)           ' !!! CHANGE TO MATCH YOUR NETWORK !!!
        ' The number I gave as my IP previously
        ' I set my router to use this number with the Spinneret.  
     
      SetSubnet(255, 255, 255, 0)          ' !!! CHANGE TO MATCH YOUR NETWORK !!!
        ' This seems to be some sort of default since mine is the same as Bean's.
     
      SetIP(71, 221, 138, 84)              ' !!! CHANGE TO MATCH YOUR NETWORK !!!
        ' From WhatIsMyIP.com
    

    I just entered these changes into my Spinneret. What am I missing?

    Thank you all very much for your help. You all were having so much fun, I wanted to join in. (Plus this could really help with my day job.)

    I believe I have "Port Forwarding" set.

    Duane
  • BeanBean Posts: 8,129
    edited 2010-11-24 10:58
    Duane,
    SetGateway should be the LOCAL ip of your router. 168.192.10.???
    SetIP should be the LOCAL ip of your spinneret (168.192.10.20)

    Nothing in the spinneret code should have your EXTERNAL ip address. The router handles that.

    Bean
Sign In or Register to comment.