On Wednesday, June 1, 2016 at 5:36:44 AM UTC-7, Isaiah wrote:
>
>
> Yes: using multiprocess parallelism instead of tasks. '@everywhere' 
> executes code on other processes that do not share the same address space 
> as the head process and cannot access the same socket. See the section on 
> Tasks in the manual.
>
> (though it probably shouldn't segfault, please file a big about that)
>

My apologies for not understanding before. I'm certain this is basic 
knowledge for someone familiar with TCP sockets, but TCP and 
parallelization are the two areas of scientific computing with which I'm 
least familiar. I couldn't glean from the documentation how the address 
space of TCP connections was handled in Julia, though the Tasks section did 
help with a REPL solution.

On that note, I think what you're driving at for the REPL is something like 
this...? 
taskHdl(conn) = Task(() -> readbuf(conn.buffer))
function readbuf(buf)
  produce(read(buf, UInt8, nb_available(buf)))
end

julia> @async (eof(conn); println("Connection ready."))
Task (waiting) @0x00007f760ee48c90

julia> Connection ready.

julia> append!(rbuf, consume(taskHdl(conn)));
Above, I append to a UInt8 array because raw data must be processed in 
520-byte packets (8-byte char ID + 512-byte packet of encoded data); 
servers *usually *send whole packets, but not *always*. 

That begs the question of how to do this in a function. In 0.5, it seems 
easy: create a RemoteChannel, open connection on remote process, dump 
packets to RemoteChannel via. "while" loop, return RemoteChannel. Is it 
really that simple?

That begs the followup question: can anything like that be done in 0.4?

Reply via email to