I try to send data with gen_tcp:send:
gen_tcp:send(Socket, <<"Test message">>).
but get error:
** exception exit: {badarg,[{io,format,[<0.31.0>,"~p~n",<<"4">>]},
                            {erl_eval,do_apply,5},
             开发者_高级运维               {shell,exprs,7},
                            {shell,eval_exprs,7},
                            {shell,eval_loop,3}]}
     in function  io:o_request/3
How can i fix it?
Thank you.
From the error message I'm guessing you have done this:
io:format("~p~n",gen_tcp:send(Socket,<<"Test message">>)).
you need to wrap your call inside a list. i.e.
io:format("~p~n",[gen_tcp:send(Socket,<<"Test message">>)]).
See the io module documentation for details on why.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论