[R-SIG-Finance] [R-sig-finance] Fwd: Question on multiple sessions...
jeff.a.ryan at gmail.com
Thu Feb 12 17:54:55 CET 2009
The issue isn't blocking vs. non-blocking, as R technically has that
as well, the problem is in reliability and performance, at least in my
readBin on *nix when non-blocking will return a character(0) (or
whatever you request) when _nothing_ is available to read. That is
testable and logical. On Windows (this is the point related to
cross-platform) it returns garbage. No way to test/etc. Additionally
you are limited by nul terminated strings in R's processing. There
are workarounds, but they are just that.
This is all within the context of IBrokers mind you, other connections
will be different in terms of requirements. IB uses simple
nul-terminated character messages.
You can of course write your own C code, use Java, or Python etc. But
that then has the multiprocess issue, and all its complexity/ugliness.
Given the correct logic I contend most everything is doable in R. And
that is a very good thing.
On Thu, Feb 12, 2009 at 10:47 AM, Daniel Cegielka
<daniel.cegielka at gmail.com> wrote:
> Jeff Ryan pisze:
>> R is single threaded. The approach I initially envisioned did involve some
>> sort of dual R-process, where communication was via a file or sockets. This
>> obviously wasn't ideal, but seemed workable.
>> Turns out that with sockets, *blocking* sockets in R are the only
>> reliable/efficient cross-platform mechanism to communicate that I have found
>> while keeping everything in R. This causes some interesting problems if you
>> are waiting for messages from another process, and those messages are
>> irregular in time. Essentially you are just shifting the issue from one
>> single-threaded process into two. Same problems persist.
> Hi Jeff ;)
> Twisted (python framework) include non-blocking function...
> It can be ported to R.
jeffrey.ryan at insightalgo.com
ia: insight algorithmics
More information about the R-SIG-Finance