[erlang-questions] open_port() on FD 0,1 problems

Daniel Goertzen daniel.goertzen@REDACTED
Tue Aug 10 18:44:42 CEST 2010


Thanks!  That helps a lot.

New issue is that erl.exe is translating incoming 0x0d bytes to 0x0a.
 Windows line-end conversions, grumble, grumble.  Is there a nice way to
turn that off?  Or am I at a dead-end?

Thanks,
Dan.

On Tue, Aug 10, 2010 at 9:05 AM, Hynek Vychodil <hynek@REDACTED> wrote:

> I don't know how on Windows but try -noinput parameter.
>
> On Tue, Aug 10, 2010 at 3:39 PM, Daniel Goertzen
> <daniel.goertzen@REDACTED> wrote:
> > I am trying to operate an Erlang Port for stdin and stdout
> > [open_port({fd,0,1}...].  The program below is to receive two integers,
> > multiply them, and write the result. Every other request vanishes without
> a
> > reply, and I don't know why.  Details:
> >
> > - Windows 7 64 bit.
> > - Erlang launched with "-noshell -s erlang_rpc_benchmark"
> > - I have to wait a moment after launching erlang before sending it data,
> or
> > I definitely get dataloss.
> > - Exactly every other packet gets lost, starting with the first one.
> > - The byte counters on Task Manager show that the request is getting to
> > erl.exe, but not to my code.
> > - I've added debug code to verify that there are no other messages
> appearing
> > at my receive expression (not currently in code below).
> > - I wrote a Python version of this program, and it worked without issue.
> >
> >
> > Background:  I plan to write a Python GUI program with an Erlang child
> > process.  The test program below is to assess Python->Erlang messaging
> > performance.  I am open to other IPC approaches if there is something
> > better.
> >
> > Thanks,
> > Dan.
> >
> >
> > -module(erlang_rpc_benchmark).
> > -export([start/0, std_server/0]).
> >
> > start() ->
> >  spawn(fun std_server/0).
> >
> > std_server() ->
> >  Port = open_port( {fd,0,1}, [{packet, 4}, binary ] ),
> >  loop(Port).
> >
> > loop(Port) ->
> >  receive
> >    {Port, { data, <<A:32,B:32>> }} ->
> >      Result = A*B,
> >      Port ! {self(), {command, <<Result:32>>}};
> >  end,
> >  loop(Port).
> >
>
>
>
> --
> --Hynek (Pichi) Vychodil
>
> Analyze your data in minutes. Share your insights instantly. Thrill
> your boss.  Be a data hero!
> Try GoodData now for free: www.gooddata.com
>



-- 
Daniel Goertzen
-----------------
dang@REDACTED (work)
daniel.goertzen@REDACTED (home)
-----------------
1 204 272 6149 (home/office)
1 204 470 8360 (mobile)
-----------------


More information about the erlang-questions mailing list