I have been playing with Both the async-protocol and the atcp-protocol
with no real success. I will post the atcp snippet in the next email.

When using the async-protocol, it seems like the event handler never
kicks off but the listen/awake function kicks seems to accept at least 1
connection because it prints "connection"

Any suggestions?



Rebol [

        Title: none

 ]

do %/d/projects/rebol/async-protocol.r

either error? try [listen: open/no-wait tcp://:8000] [
  port: open async://localhost:8000
  port/awake: do handler
] [
    listen/awake: func [l /local p] [
      print "connection"
      p: first listen
      remove find system/ports/wait-list listen
      port: make port! [scheme: 'async sub-port: p]
      open port
      port/awake: do handler
      false
    ]
  insert tail system/ports/wait-list listen
  port: none
]


handler:  [use [ buffer ] [
  buffer: copy []
  func [port [port!] state [word! error!] /local tmp cmd] [=20
  if error? :state [print mold disarm state return true]
  switch state [
   =20
    connect [print "connected event"]
   =20
    read    [
              append buffer copy port
              while [tmp: find buffer newline] [
                cmd: copy/part buffer tmp
                remove/part buffer next tmp
                print cmd
              ]
              false
            ]
    write   [false]
    close   [print "Connection Closed. " close port true]
  ]
  ]
  ]
]

forever [wait []]

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Peter WA Wood
Sent: Saturday, November 13, 2004 9:56 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] Re: Async Question


Anton

Thanks for the neat summary.

Is there a "to" missing between was and provide in the following =20
sentence ?

The reason Rebol Technologies finally added this was provide a standard

async root-protocol.

Regards

Peter

On Saturday, Nov 13, 2004, at 22:45 Asia/Kuala_Lumpur, Anton Rolls =20
wrote:

>
> This document (composed tonight) might help you
> to make a decision:
>
> http://www.lexicon.net/antonr/rebol/doc/ASYNC-The-available-=20
> implementations.
> txt
>
> Anton.
>
>> Wardell, Charles  wrote.. apparently on 12-Nov-2004/13:17:51-5:00
>>> Can someone give me an example of how to use the async-protocol.r
>>> I did not find any documentation other then the comments in the .r =20
>>> file.
>>>
>>
>> http://www.compkarori.com/vanilla/display/async-tutorial
>>
>> --
>> Graham Chiu
>
> --=20
> To unsubscribe from the list, just send an email to rebol-request
> at rebol.com with unsubscribe as the subject.
>
>
>

--=20
To unsubscribe from the list, just send an email to rebol-request
at rebol.com with unsubscribe as the subject.


-- 
To unsubscribe from the list, just send an email to rebol-request
at rebol.com with unsubscribe as the subject.

Reply via email to