[erlang-questions] gen_tcp send blocks gen_tcp recv.
Arun Muralidharan
arun11299@REDACTED
Mon Sep 3 17:31:19 CEST 2012
Can you be more specific on how your sending process is overloading your
receiving process(P1) by making a "blocking" call ? I didnt quite get it.
Why dont you try an async design pattern as shown in
http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles
-Arun
On Mon, Sep 3, 2012 at 12:47 PM, Erik Søe Sørensen <eriksoe@REDACTED>wrote:
> Have you considered having one process for sending and one for receiving
> (on the same socket)?
> Den 03/09/2012 06.47 skrev "Satyam Shekhar" <satyamshekhar@REDACTED>:
>
>> Hi,
>>
>> I know this question has been asked many times.
>>
>>
>> http://erlang.2086793.n4.nabble.com/Non-blocking-sends-in-gen-tcp-td2114537.html
>>
>> https://groups.google.com/forum/?fromgroups=#!topic/erlang-programming/4DBmCK4GAK8
>>
>> 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?
>>
>> Regards,
>> Satyam Shekhar
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120903/6f7b3b99/attachment.htm>
More information about the erlang-questions
mailing list