[REBOL] Re: Problem: Talking from Rebol to Rebol via socket
From: robert::muench::robertmuench::de at: 22-Feb-2009 14:26
-----BEGIN PGP SIGNED MESSAGE-----
Am 22.02.2009, 11:51 Uhr, schrieb Petr Krenzelok <petr.krenzelok-seznam.cz>:
> Bug here - it should be - insert c-client. You can't insert into
> listening socket, just to derived connection channel.
Hi, ok, I got this now :-).
> But - your script
> will not even get here. You use blocking synchronous communication. In
> this mode, it seems to me, that you stay stuck in the 'copy section,
> until you close the connection on the other side.
Good point and is something I observed too. But it's not documented when using synchronous
mode how to get things transferred. So the listening part hangs until the other side
closes the socket, than the so far received content is returned.
This means, that using synchronous mode isn't feasible to send messages back and forth
over the same socket.
> I don't use any other mode than open/direct/no-wait .... you have to be
> just carefull here - you need to "wait", or the program runs out ...
Ok, thanks. While scanning some other Rebol scripts I saw this sometimes. But again,
the docs are a bit simple on all this. I expect this to be the same problem in my other
post. Because Rebol uses the synchronous mode, I just can't swap directions. I will look
into this /direct/no-wait stuff.
> In your while look, when reading out the data, you can receive empty result
> = no data, or none = other side closed the connection ....
Ok, that maps to socket behavior on the C level. Makes sense.
> If you want better multiplexing, it would be probably better to build wait block,
> along with time interval, so you either get your processing by an event
> received from network, or time timeout ....
Yes, whereas my goal is to just send messages back and forth using the same socket/connection.
> Here's small examples:
Thanks, this brings me a step forward.
Robert M. M=FCnch
Management and IT freelancer
-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.9.1 (Build 287)
-----END PGP SIGNATURE-----