[erlang-questions] gen_tcp send blocks gen_tcp recv.
Mon Sep 3 06:47:23 CEST 2012
I know this question has been asked many times.
But my concern is slightly different. I have a separate sending/receiving
process, P1, for a gen_tcp socket which receives messages it has to send,
from process P2. There is no acking between the P1 and P2. Data is buffered
at P2 and data acking is client driven, i.e that client says how much data
it has received when it reconnects. Right now, P2 sends data to P1 as soon
as it generates any data, and also adds it to its buffer, so that it can
send it to the client if the socket gets closed before client receives it.
The issue is, since the gen_tcp send call is blocking, and P2 might flood
P1s mailbox at times, received messages(socket in active once mode) from
the client are delayed quite a bit.
What is the best way to handle this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions