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

[REBOL] Network Port Reading Problem Re:

From: holger:rebol at: 7-Sep-2000 15:46

On Thu, Sep 07, 2000 at 03:18:38PM -0700, [rsnell--webtrends--com] wrote:
> I need to implement a telnet client in Rebol for a fixed task (that is, I > don't > want a terminal type thing - all client commands are fixed and will be run > with no user interaction).
Try something like this. Only works with current experimental versions of REBOL ( though. peer: open/direct/binary/no-wait tcp://myhost:23 forever [ wait peer input-data: copy peer ; Handle your data here and insert the response, e.g. ; insert peer #{fffc25} ; The following print is just an example... print input-data ] The direct/no-wait ensures that copy returns whatever data is available. Without it copy usually blocks until the peer signals end-of-file. The wait is necessary to avoid busy-looping on copy. If copy returns an empty series (#{}) then this means no data is available (should not happen after a wait). If copy returns none then the peer has closed the connection. -- Holger Kruse [holger--rebol--com]