这是我接收数据的代码
-module(t).
-compile(export_all).
start() ->
{ok, LSock} = gen_tcp:listen(5555, [binary, {packet, 0},
{active, false}]),
{ok, Sock} = gen_tcp:accept(LSock),
{ok, Bin} = do_recv(Sock, []),
ok = gen_tcp:close(Sock),
Bin.
do_recv(Sock, Bs) ->
io:format("(="), io:format(Bs),io:format("=)~n"),
case gen_tcp:recv(Sock, 0) of
{ok, B} ->
do_recv(Sock, [Bs, B]);
{error, closed} ->
{ok, list_to_binary(Bs)}
end.
我串行发送到套接字 - 1,然后是 2,然后是 3,然后是 4,然后是 5
代码是累积接收到的数据
它打印到屏幕上
(=12345=)
如何将代码修改为打印的代码
(=1=)
(=2=)
(=3=)
(=4=)
(=5=)
该数据未累积