Vote count:
0
Consider the following:
{ok, ListenSocket} = gen_tcp:listen(Port, [binary, {packet, 4}, {reuseaddr, true}, {active, once} ]),
{ok, AcceptSocket} = gen_tcp:accept(ListenSocket),
receive
{tcp, Socket, Bin} ->
case binary_to_term(Bin) of
{store, Value} ->
Uid = kvstore:store(Value),
send(Socket,Uid);
{retrieve, Key} ->
send(Socket,kvstore:retrieve(Key))
end
end
(The send fun closes the socket).
- I'm assuming that the EVM takes care reconstructing the n packets that make up the message and not user code?
- In which case is there a risk that a very large message could overflow the socket buffer?
- Are these statements equally true for UDP?
asked 35 secs ago
Erlang network programming TCP and UDP messages v packets
Aucun commentaire:
Enregistrer un commentaire