Skip to content

Instantly share code, notes, and snippets.

@otrack
Created November 14, 2018 15:09
Show Gist options
  • Save otrack/2b5ab474db19a2b05503fb97b8759f48 to your computer and use it in GitHub Desktop.
Save otrack/2b5ab474db19a2b05503fb97b8759f48 to your computer and use it in GitHub Desktop.
application:ensure_started(java_erlang),
{ok,NodeId} = java:start_node([{add_to_java_classpath,["vcd.jar"]}]),
Conf = java:call_static(NodeId,'org.imdea.vcd.Config',parseArgs,[""]),
Socket = java:call_static(NodeId,'org.imdea.vcd.Socket',create,[Conf,10]),
SentSet = java:call_static(NodeId,'org.imdea.vcd.Generator',messageSet,[Conf]),
SentBytes = java:call(java:call(java:call(java:call(SentSet,getMessagesList,[]),get,[0]),getData,[]),toByteArray,[]),
io:format("array is ~p~n",[java:array_to_list(SentBytes)]),
java:call(Socket,send,[SentSet]),
RcvSet = java:call(Socket,'receive',[]),
RcvBytes = java:call(java:call(java:call(java:call(SentSet,getMessagesList,[]),get,[0]),getData,[]),toByteArray,[]),
io:format("array was ~p~n",[java:array_to_list(RcvBytes)]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment