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

[REBOL] Re: Might as well ask..

From: gscottjones:mchsi at: 3-Oct-2002 18:08

Whoops. Forgot to close the server socket and take out some debugging print statements. --Scott Jones rebol [ "TCP File Client" ] port: open/lines/direct/no-wait tcp://localhost:5242 either error? try [ insert port "nyc.jpg" ][ print "whoopsie - where's the beef?" ][ wait port response: first port either find response "OK" [ set-modes port [binary: true] set-modes port [lines: false] outfile: open/binary/direct/write/new %//windows/desktop/nyc.jpg while [data: copy/part port 32768] [ append outfile data ] print ["file received"] close outfile ][ print "Hmmm - We've got a problem, Houston." ] ] close port ---------------------------- rebol ["TCP File Server" ] listen: open/lines/direct/no-wait tcp://:5242 connection: first listen wait connection either error? try [ fname: first connection ][ insert connection "Error - Go fish ..." ][ insert connection "OK - Get Ready..." set-modes connection [binary: true] set-modes connection [lines: false] file: open/binary/read/direct join %//rebol/view/ fname while [data: copy/part file 32768] [ insert connection data ] print ["file sent"] close connection close file ] close listen