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: robert::muench::robertmuench::de at: 23-Feb-2009 9:45

Am 22.02.2009, 15:40 Uhr, schrieb Petr Krenzelok <petr.krenzelok-seznam.cz>:
>> Is there a way that I can WAIT to "read a message" or "send a message"? >> I'm missing a way to control/react on the communication direction flow.
Hi, (why are my lines broken with this = char? Is it again a encoding problem from Opera?)
> yes, there is. In async mode, you are responsible for "waiting for > signal" - you have to do handshaking yourself.
No problem, is there an example? Do I get signals like "ready to send", data can be read ?
> As I said in my previous > email, be carefull, as you will run out from your data :-)
That's normal TCP behaviour. On the C-level I can loop and check read/write Status, read partial things etc. The problem I have is, that I don't know how Rebol handles these situations nor how I'm supposed to do it.
> So, look into your server. You wait for first connection. Good. Then you > get your > connection, enter forever loop, but you don't wait for the other side!
Ok, how do I wait for the other side? Is just adding a WAIT CONNECTION enough?
> Copy is not blocking, so it copies from the OS buffer (direct mode), and > there is no data (empty string returned). Put wait c-client as first > means of forever loop.
Ok, the WAIT read: Wait until something is available in the OS read-buffer.
> wait port ; or wait/all [port1 port2 0:00:01], whatever ... > while [not empty? data: copy port][append result data] > > remember, that one call to 'copy just reads out what is available at the > given time.
Yes, I know. I will try playing with WAIT.
> If you want to look how to read data from many ports, Sterling's proxy > script in rebol.org archive was always a good inspiration for me, as it > was able to open multiple connections, keep pairs of send/rcv ports > stored, etc.
Most scripts assume a request/response model or use the HTTP schemes. What I want to do is: Using one port for sending and receiving while doing ping-pong between two clients.
> Robert- here's my "multiserver" script I did for my friend some time > ago. He was doing some embedded stuff and wanted me to catch data from > devices, write them down to file, and log events. Not sure it will work > for you, as I now translated it into english, including variables. > Hopefully no bug there:
Ok, thanks I take a look. Handling transmission in only one direction is not the problem. It's switchting between receiving and sending and getting the WAITing etc. correct. So, next round :-) I'll let you know. If someone has more information or an exmaple, please let me know. -- Robert M. Münch Mobile: +49 (177) 245 2802 http://www.robertmuench.de