Communicating with erlang server via c++ (Sending Binary)

Ive been developing a project using erlang, sfml, and c++ in order to create a networked game. Ive done communications from erlang - erlang with some success however im encountering some issues intergrating c++.

Previously i was able to send data in this format (from the 'client'):

 gen_tcp:send(Socket, term_to_binary({Cmd, Parameters}));
 gen_tcp:send(Socket, term_to_binary({Cmd, {P1, P2}, P3}));
 gen_tcp:send(Socket, term_to_binary({Cmd}));
 gen_tcp:send(Socket, term_to_binary({Cmd, Msg}));

And process the data using a case:

client_handler(Socket) ->
io:format("Waiting for data...~n", []),

case gen_tcp:recv(Socket, 0) of  
{ok, Bin} ->
  Cmd = binary_to_term(Bin),
  io:format("Command '~p' received.~n", [Cmd]),

case Cmd of
    {register, NewAtom} ->          
        %%Do Stuff        
    {update_transform, {X,Y}, Rot} ->
        %%Do Stuff    
    {get_transform} ->
        %%Do Stuff  
    {send_message, Msg} ->
        %%Do Stuff    
    _ ->
       %%Do Stuff


{error, _} ->
  io:format("Lost connection to client!~n", [])

Is there any way for me to send data across like this using c++? I realize its just building binary stings but i dont know what format the data needs to look l until now its not something i've had any experience doing with c++

Thanks in advance!!!


C++/C can use the ei library to encode data into Erlang terms to send an Erlang application over a socket, and receive and decode Erlang terms as well. Writing such a C++/C application is tedious but once you get the basic code in place, it works pretty well.

It's also possible to write a non-Erlang node, called a C node, that communicates with an Erlang node via Distributed Erlang. You can do the same for Java using the JInterface package. To the Erlang node, such a node appears as just another node in its cluster. As with ei applications, writing such nodes can be tedious, but they can be handy when you have non-Erlang code you want to seamlessly and safely integrate into an Erlang cluster.

Need Your Help

SQL Query for poorly designed database

sql-server xml tsql

I have a table with data in it like the following:

JavaFX Chart to Image to Base64 String use in PHP

java php image javafx base64

i'am using JavaFX and illustrate a Chart with the LineChart concept in Javafx.