ARMweb update

Questions about the BASICtools and MakeItC
Post Reply
basicchip
Posts: 956
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA
Contact:

ARMweb update

Post by basicchip » Tue Dec 18, 2012 4:34 pm

The ARMweb has been set up as a server. For years we've been asked to add the client side, and for the longest time we just thought that would be too involved. But really we weren't seeing the simple side of that request. What most wanted was the ability for the ARMweb to do a GET or POST to a web server, and use that to process remote data, and for most what the server returns was really of no consequence. So enough of you finally beat through our heads that we should add a simple GET/POST which is now part of the firmware. In BASIC you can access it through --

Code: Select all

' HTTP example will wait up to 5 seconds for a SYNC then wait up to 5 seconds for a response
' During this time your basic program will not respond

DIM A$(256)

' Build a request string, could also be a POST, could also include CGI
A$ = sprintf("GET /%c%c%c%c",13,10,13,10)

'Example read a local page server
HTTP ((192<<24)+(168<<16)+(1<<8)+4, A$)

' Another way to builod the string
'HTTP ((192<<24)+(168<<16)+(1<<8)+4, "GET /" + chr(13) + chr(10) + chr(13) + chr(10) )

'up to 256 bytes of response are returned in the CGI buffer
'headers are stripped so only page text is returned

'sit and listen up to 5 seconds for any incoming HTTP response
A$=""
START = TIMER
WHILE A$(0) = 0 and TIMER-START < 5000000
  A$ = CGIIN
LOOP

PRINT " read "; LEN(A$); " bytes"
printf("%s", A$)
 
For now the first 256 bytes returned by the server are available in the CGIIN buffer.

To use this update the ARMweb with the attached firmware
Attachments
web0757.hex
ARMweb firmware 7.57
(330.07 KiB) Downloaded 289 times



Post Reply