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

[REBOL] Re: webserv.r for local use?

From: antonr::lexicon::net at: 17-Mar-2005 1:42

Ok, example: Open up a rebol console and type this: listen: open tcp://:4351 wait listen conn: first listen Now open up a second rebol console and type: port: open tcp:// Back at the first console: type? conn ;== port! conn/remote-ip ;== So here is where you examine the remote-ip and decide whether to close the port or not. Now, I've used words similar to those used in webserv.r, but here is the line in the handle-new-connections function I think you need to change: if error? try [ request: parse first (conn: first listen) none ] [ close conn return ] to: if error? try [ conn: first listen ; conn is a port! if conn/remote-ip <> [make error! "Non-local connection!"] request: parse first conn none ][close conn return] I haven't tested it, but that should work. Anton.