HTTP help please


Closed Thread
Results 1 to 13 of 13
  1. #1

    Default HTTP help please

    I've downloaded Fred Eady's mini ethernet picbasic code module, but before I get too involved can anyone tell me if it will be possible for me to use it as a small HTTP server ?

    I have a zigbee network of machines, each one outputs about 20 bytes every thirty minutes, which I am storing on the main coordinator. I need to gateway/bridge the stored information onto a small webserver to make it available over the internet.
    Ideally the person viewing the page should get to see the data contained as a set of fields in a file (format unknown just yet) so I suppose I am talking about small dynamic web pages here.

    I don't think huge graphics are required (except maybe a line graph).

    <RANT>
    The backstory to this is that the Lantronix XPORT won't allow me to put data into internal memory for serving onto a web page. The XBEE based Rabbit Semiconductor Zigbee demo kit I bought for this first of all only had Series 1 XBEE modules inside and weren't zigbee compatible. The latest CYAN Technology ethernet/zigbee gateway I bought as a replacement for the Rabbit kit won't actually let you use the SD Card or USB modules while the zigbee network is operational (Despite a big clear picture and description in the datasheet calling it the 'demo configuration'), and so, like the Rabbit kit, that will be getting returned for a refund now too.
    </RANT>

    I just need to squirt a few bytes, infrequently, into a server, where the server will need to act as a buffer either using internal memory or offboard embedded SD card type device (I2C/SPI etc)

    (The reason for not coding the XPORT via the custom firmware devkit is that I don't feel my C programming is up to it, and my PicBasic and ASM is so much better ! IMHO)

    Any ideas ?
    Chris

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Spamming my own thread with an update.

    I now have a Lantronix XPORT with Beta firmware tunneling the HTTP requests directly to it's serial output, connected to USART2 on a pic 18F87J10.

    The pic parses the GET string and gets the files from an SD card (attached to the SPI port) and serves them up, to make a web server.The dynamic nature and variable length data means that the HTTP data is output in chunked format.

    The files on the SD card are a combination of pre-made headers, and some dynamic files comprising data collected from a zigbee network, received via USART1

    Only serving pages at 56k for the time being, until I get the appropriate crystal, but I've finally got my gateway working, which is pleasing :-)

    The ready made HTML pages are made in Frontpage, saved to the root directory on the SD card, along with any images, and the card then plugs into the server.

    I need to include the PUT method now, so that I can upload pages to the SD card, then I've got the full server working !

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    I'm interested in your project, and would like to see your code when you get it completed. I'm using an XPORT as well, and with custom code which allows me to do SNMP.
    Charles Linquist

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    I'm interested in your project, and would like to see your code when you get it completed. I'm using an XPORT as well, and with custom code which allows me to do SNMP.

    Charles, the firmware in the XPORT may be the same firmware yoiu have. I am told it allows SNMP, but because I don't need to use it (can't think of anything 'creative' to do with it ?) I have not yet looked at it.

    The XPORT tunneling of HTTP on port 80 produces headers like....

    Code:
    GET /index.htm HTTP/1.1                       
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shock                                                                                
    wave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application                                                                                
    /msword, */*            
    Accept-Language: en-gb                      
    Accept-Encoding: gzip, deflate                              
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0                                                                                
    .50727; .NET CLR 1.1.4322)                          
    Host: 192.168.0.9                 
    Connection: Keep-Alive

    ....Which is useful because at last you can write your own pages without needing to store them on the COBOX, and that means that _dynamic_ pages with variable sized data fields can be used.

    I'm just using plain HTML right now but I've tried some Java objects and they seem to work fine.

    The only downside is that because I'm using SDFS which doesn't seem to support directories, all of my webpages are stored in the root directory.


    I'm just going to take a break but I'll leave the server running for you for the next hour or two. Not much to see but one page is
    http://92.8.106.11/MACMON01.htm
    and another is
    http://92.8.106.11/INDEX.HTM

    There's also an image on the SD card http://92.8.106.11/PICTURE.GIF

    Those pages are coming live from an SD card. They are complete files and the images are served correctly by subsequent GET methods (I didn't think the code would deal with that situation properly but to my pleasant surprise it does !)



    With the exception of the 'index.htm' file, ALL filenames are
    [8-characters] . [3-characters] , all in uppercase.

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Impressive! I have a need for something like this. Collaboration?
    Charles Linquist

  6. #6


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    Impressive! I have a need for something like this. Collaboration?
    Sure !
    I'm happy to hear what you're proposing :-)

  7. #7
    Join Date
    Apr 2008
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Ethernet Mini

    I am curious if any of you are still working on Ethernet Mini or not. I would like to make a small HTTP server. I am new on this. I would like to see your code or picture of your project.

    Reid

  8. #8


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Reid View Post
    I am curious if any of you are still working on Ethernet Mini or not. I would like to make a small HTTP server. I am new on this. I would like to see your code or picture of your project.

    Reid
    Reid,
    I used a Lantronix Xport-03, which has the ability to do port redirection between the ethernet socket and the two wire serial interface. This means that you can attach a pic to the serial port of the Xport and read the actual HTTP requests for files as they arrive, and in my case i responded by serving the suitable file from an SD memory card.

    I would recommedn that you look at the relevant RFC documentation covering things like HTTP, TFTP and FTP etc, because you will be working with it at a very low level if yoiu decide to go down this route.

    you would also need a fast method for serving files, which in my case consisted of reading a block of 512 bytes from the SD Card into a buffer on the pic and then using Hserout to transmit the buffer's contents to the serial port of the Xport. The actual etehernet side of things is dealt with for you by the Xport The SD Card used 2 wire SPI mode, which actually seemed quite slow in the end, especially when serving images >20kB in size and I would have preffered to use the 4 wire mode. But I got the SD software (SDFS) for free and mustn't complain.

    If you take a step back from what you are trying to achieve, you really are only moving large chunks of data between devices. The remote web server 'knows' what to do with the file it requested, yoiu simply need to send it when requested. Unless, you want to start serving live data. I ended up serving live data via an HTML file which is created only once, at the time the request for the data is made, and the usual HTML tags are inserted one by one as part of a loop. This probably also led to the program being slower than I would have liked.

    There are a lot of options available now for bridging a pic to the internet and I think yoiur best source of info is going to be the datasheets from the devices themselves. As well as the Xport, there is also something called a 'WebLynx' which seems to be similar although I am not sure if they are doing port redirection with that device yet.

    Chris

  9. #9
    Join Date
    Apr 2008
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Ethernet Mini

    Chris,

    Maybe I did not make myself clear. At first I would like to use webpage that go into ethernet Mini to look up something on it. just like a router 192.168.01What I would like to make a simple task. I would like make port A0-A4, B0-B4 ,C0-C4, D0-D4 to turn it on (high) or off ( low) or read those port the value. I hope myself clear. I am not sure if we called it as web server or just remote the hub. I was hope someone has done this. I would like to see sample codes.

    Reid

  10. #10
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Chris,
    Fred participates here, and makes contact info available on his web site. Your project idea might be just what he's looking for, why not ask Fred if it'll work?
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  11. #11


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Hi Chris,
    Fred participates here, and makes contact info available on his web site. Your project idea might be just what he's looking for, why not ask Fred if it'll work?

    In honesty the reason I posted was in the hope that Fred would contribute if he was able to assist or had the time to spare, and I've taken it that because he hasn't responded he had nothing to add. Perhaps he didn't read the message though ?

    I have completed the project now so I'm fine. Although I would still be interested if the ported ethernet stack could be adapted to work as a TCP port redirector, it could be usefuyl at some time in the future !

    Chris

  12. #12


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Reid View Post
    Chris,

    Maybe I did not make myself clear. At first I would like to use webpage that go into ethernet Mini to look up something on it. just like a router 192.168.01What I would like to make a simple task. I would like make port A0-A4, B0-B4 ,C0-C4, D0-D4 to turn it on (high) or off ( low) or read those port the value. I hope myself clear. I am not sure if we called it as web server or just remote the hub. I was hope someone has done this. I would like to see sample codes.

    Reid
    Sorry Reid, mixed communications !

    By port number redirection I am referring to the TCP/IP port. EG HTTP uses port 80, and so on.

    The ethernet Mini appears to output raw packet data, which would require further desemination before you can get to the data you require. Although I don't have an ethernet Mini and may be speaking out of turn, it will demand some additional data processing to be applied before you get down to the basic transactions and connection handling.

    Have you looked into HTTP ?

    I guess from your message that you want to make some sort of remote control system, where you can send a command from a remote web connected PC, possibly via a browser, to interact with the hardware attached to the ethernet mini.

    You could do this a number of ways, from using HTTP to TFTP, SNMP could also work, but I would suggest looking into those protocols more closely to find the one best suited to the functionality you are looking for.

    Of course, you could easily implement your own protocol once you are handling TCP/IP or UDP directly, but it is usually a good idea to stick with accepted protocols over the internet.

    If you can explain more about the type of functionality you need, and if it needs to operate in both directions, we might be able to pin things down more precisely

  13. #13
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default Siteplayer

    You might want to have a look at the Siteplayer webserver. I've been using the Siteplayer for a few years now. Very easy to get started with. Been interested in Lantronics and also the Rabbit solution but never experimented with them. I know Microchip also offers some form of web interface but I've never been able to wrap my head around it.
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

Similar Threads

  1. xport code, have example, confused though
    By kenpo in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 30th March 2009, 19:59

Members who have read this thread : 1

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