[erlang-questions] gen_tcp:send timeout

Dmitry Kolesnikov <>
Wed Nov 12 10:16:21 CET 2014


I am looking on timeout issue with gen_tcp:send. 
I’ve not discovered yet the reason but my sender process is stacked at

The timeout will help me but I’am confused on the way to achieve it

* gen_tcp provides an option {send_timeout, xxx}. The documentation says "The fact that the send call does not accept a timeout option, is because timeouts on send is handled through the socket option send_timeout."

* there was a recommendation for Heroku to use erlang port directly to handle timeout
send(S, Data, Timeout) ->
   true = erlang:port_command(S, Data, []),
      {inet_reply, S, Status} -> 
      after Timeout ->
         {error, timeout}

What is your experience to on this issue?
What is the best way to handle it in production?

Best Regards, 

More information about the erlang-questions mailing list