<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Kirill,</div><div class="gmail_default" style="font-size:small"><br></div>I believe that the option you are looking for is <div class="gmail_default" style="font-size:small;display:inline">​​</div>SO_LINGER<div class="gmail_default" style="font-size:small;display:inline">​.</div><div><div class="gmail_default" style="font-size:small;display:inline">​I​</div>n Erlang it is {linger, {boolean(), integer() >= 0}}<div class="gmail_default" style="font-size:small;display:inline">​​. </div>In your case one of the transport_config option.​<div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I recommend this article: <a href="http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-and-scalable-servers.html">http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-and-scalable-servers.html</a> which explains in details how and when to use this option.</div></div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I hope that helps. Btw what OS are you using?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Cheers,</div><div class="gmail_default" style="font-size:small">Lukasz</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 10, 2015 at 9:40 AM, Kirill Ratkin <span dir="ltr"><<a href="mailto:kvratkin@gmail.com" target="_blank">kvratkin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div>Hi,<br><br></div><div>I have two functions listed below:<br></div><div><br></div>service_start(Name) -><br></div><div>%% ... skipped some preparation steps for service activation <br>    Opts = [{'Origin-Host', atom_to_list(Name) ++ ".<a href="http://example.com" target="_blank">example.com</a>"},<br>               {'Origin-Realm', "<a href="http://example.com" target="_blank">example.com</a>"},<br>               {'Vendor-Id', ?VENDOR_ID},<br>               {'Product-Name', "Just Diameter Server"},<br>               {'Auth-Application-Id', Ids}] ++ Apps,<br><br></div><div>    TransportOpts =  [{transport_module, T},<br>                      {transport_config, [{reuseaddr, true},<br>                                          {ip, IP},<br>                                          {port, P}]}],<br>    diameter:start_service(Name, Opts),<br>    diameter:add_transport(Name, {listen, TransportOpts}),<br>    diameter:subscribe(Name).<br><br><br>service_stop(Name) -><br>    diameter:unsubscribe(Name),<br>    diameter:remove_transport(Name, true),<br>    diameter:stop_service(Name).<br><br></div>When I do service_start the Port is listen to incoming messages.<br></div>Then I want to stop service. (there are no clients connected to service) <br>I do 'service_stop' and diameter:services() says '[]'. So there aren't any active services.<br></div>But 'netstat' shows port is in LISTEN state:<br>tcp        0      0 <a href="http://127.0.0.1:3868" target="_blank">127.0.0.1:3868</a>         0.0.0.0:*               LISTEN<br></div>After about 30 seconds port is closed.<br><br></div>It seems 30 secs is too long ... How can I configure this timeout?<br></div><br></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>