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

[REBOL] Re: Problem: Talking from Rebol to Rebol via socket

From: sqlab:gmx at: 23-Feb-2009 13:00

ok, the same example with waiting for events and ping pong messages in a 10 sec forever intervall. This you can do with many sockets too, but then it is more elegant to use awake finctions. rebol [] c-port: 12345 listen: open/no-wait join tcp://: c-port waitports: [listen] print "Listening:" forever [ ; wait until something happens either same? listen connection: wait waitports [ print [tab "Connected"] c-client: first connection append waitports c-client ] [ print [tab "Read message from c-side"] msg: copy connection either not msg [ print [tab "Closing socket"] close connection ] [ print msg print [tab "Send answer to c-side"] insert connection "r-side" ] ] ] rebol [] connection: open/no-wait tcp://localhost:12345 forever [ insert connection "r-side-client" wait connection probe copy connection wait 10 ] Robert M. Münch wrote: