[erlang-questions] Erlang gen server and c++ client
Bengt Kleberg
bengt.kleberg@REDACTED
Wed Jun 13 14:16:38 CEST 2012
Greetings,
To run Erlang code you need to put it into a module (file) and compile
it. See http://learnyousomeerlang.com or another similar website.
bengt
On Wed, 2012-06-13 at 11:51 +0200, benefit wrote:
> Hello.
> Please help me.
> I need to make a erlang gen_server which works with an erlang port.
> An c++ application must connect to erlang port and send a string. Server
> should return the same string to the application.
>
> I have troubles working with erlang.
> I found an example code :
>
> connect(Message) ->
> Cmd = "./myqtwindowapp \n",
> Port = open_port({spawn,Cmd}, [stream,use_stdio,exit_status]),
> Payload = string:concat(Message, "\n"),
> erlang:port_command(Port, Payload),
> receive
> {Port, {data, Data}} ->
> ?DBG("Received data: ~p~n", [Data]),
> Other ->
> io:format("Unexpected data: ~p~n", [Other])
> after 15000 ->
> ?DBG("Received nothing~n", [])
> end.
>
>
> But i dont know how to run this code. I tried erl -run serv start but
> recieved error in do_boot. And how to include this code into a small module?
> Even i recieved error in dbg macros.
>
> Please help me. Suggest me how to finalize. I am newbie here, please suggest
> me how to run this code or other.
> Any help is appreciated.
>
> --
> View this message in context: http://erlang.2086793.n4.nabble.com/Erlang-gen-server-and-c-client-tp4655136.html
> Sent from the Erlang Questions mailing list archive at Nabble.com.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list