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: petr:krenzelok:seznam:cz at: 23-Feb-2009 15:31

Robert M. Münch napsal(a):
> Am 23.02.2009, 13:00 Uhr, schrieb sqlab <>: > >> ok, the same example >> with waiting for events and ping pong messages in a 10 sec forever >> intervall. >> > > Hi, thanks this now works. Great! :-) > > So the only change was on the client using a WAIT. >
Yes, it could be said so.
>> This you can do with many sockets too, but then it is more elegant to >> use awake finctions. >> > > Yes, it just want to start simple :-) > > Some questions regarding time-outs etc. > > 1. If I make a connection from the client but don't send anything. Will a > timeout happen on the server side? Where can I get/set this timeout value? >
When you make a connection, timeout happens on listening socket (tcp://:12345). Each port has port/timeout value. For tcp ports, it is by default set to 30sec. You can change the value, if you want. Reading dns can be made async too. The only thing, we can't have async in R2 is if the other side is not responding to connection request (e.g. listening server not available, server down, etc.). The only thing you can do is to just - wait for timeout on port trying to make a connection. IMO 30sec. default timeout is nonsense nowadays, I would lower it to 5 or 10 secs. But - apart from that, you are pretty much async even with R2. What I am not clear about is R2's 'wait function. When you e.g. do something following: 1) wait [server client1 client2 client3 timer] 'wait returns first port with event. You react to event, OK. At next loop (wait) iteration, it return first port with event too. But what if there is new event on the same port? Will other ports be handled? Or will first port in block has some logical precedence? note: the timer above DOES NOT mean, that you get your processing at the defined timer tick! It just means - either we get an event on one of ports, or we get a timeout on timer. 2) wait/all [server client1 client2 client3 timer] you receive a block with all event ports. You then have to loop over it, to serve those ports. Maybe this is better option that the first one? (albeit the event processing loop will be a bit more complicated) -pekr-