Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Creating Servers in Rebol on Linux Re:(2)

From: ryanc:iesco-dms at: 28-Aug-2000 13:46

Jeff, This one can be started and stopped. It also traps any errors in the forever loop, making it somewhat impervious. Also note the complete lack of security. --Ryan rebol [ Title: "Even More Slightly Upgraded SID Server" ] running: FALSE listen-port: open/lines tcp://:8080 max-sid: "5000" send-http: func [data mime] [ insert data rejoin ["HTTP/1.0 200 OK^/Content-type: " mime "^/^/"] insert http-port data ] command-list: [ "/kill" [ mime: "text/html" send-http copy "<H1>SERVER KILLED</H1>" mime close http-port quit ] "/reset" [ mime: "text/html" send-http copy "<H1>SERVER RESET</H1>" mime max-sid: "5000" ] "/start" [ mime: "text/html" send-http copy "<H1>SERVER STARTED</H1>" mime running: TRUE ] "/stop" [ mime: "text/html" send-http copy "<H1>SERVER STOPPED</H1>" mime running: FALSE ] "/" [ either running [ max-sid: form (load max-sid) + 5000 mime: "text/plain" send-http copy max-sid mime ] [ mime: "text/html" send-http copy "<H1>SERVER NOT RUNNING</H1>" mime ] ] ] forever [ error? try [ http-port: first wait listen-port request: first http-port command: second parse/all request " " do select command-list command close http-port ] ] -- Ryan Cole Programmer Analyst www.iesco-dms.com 707-468-5400