3
使用以下代码发送。该调用gen_tcp:发送调用返回{错误,EINVAL}但我想不通为什么...通过TCP发送Erlang中的二进制文件
-define(TCP_OPTIONS,[binary, {active, false}, {reuseaddr, true}]).
client() ->
case gen_tcp:connect(to_Server(), 8080, ?TCP_OPTIONS) of
{error, Reason} ->
io:format("~p~n",[Reason]);
{ok,My_Socket} ->
Message = {"stuff", hello, "data"},
B_Message = term_to_binary(Message),
OK = gen_tcp:send(My_Socket, {message,B_Message}), % error here
OK = gen_tcp:close(My_Socket)
end.