[erlang-questions] Bug? inet:listen_options discards extra raw options?

Roger Lipscombe <>
Tue Mar 25 17:55:29 CET 2014


I'm attempting to pass a bunch of raw options to ssl:listen, in order
to configure TCP keep-alive behaviour.

When I run strace, I see only one setsockopt call corresponding to
only one of my raw options.

Upon further investigation, I see the following:

(<0.198.0>) call inet:listen_options([{port,0},
 {raw,6,6,<<2,0,0,0>>},
 {raw,6,5,<<5,0,0,0>>},
 {raw,6,4,<<5,0,0,0>>},
 {keepalive,true},
 {raw,6,2,<<64,2,0,0>>},
 {port,31337},
 {mode,binary},
 {active,false},
 {packet,raw},
 {reuseaddr,true},
 {nodelay,true},
 {backlog,1024},
 {send_timeout,30000},
 {send_timeout_close,true}],inet)
(<0.198.0>) returned from inet:listen_options/2 -> {ok,
                                                    {listen_opts,
                                                     {0,0,0,0},
                                                     31337,1024,-1,
                                                     [{send_timeout_close,
                                                       true},
                                                      {send_timeout,30000},
                                                      {nodelay,true},
                                                      {reuseaddr,true},
                                                      {packet,raw},
                                                      {active,false},
                                                      {mode,binary},
                                                      {raw,{6,2,<<64,2,0,0>>}},
                                                      {keepalive,true}]}}

It appears that inet:listen_options/2 is throwing away my extra raw
options. Is this expected behaviour, or is it a bug?

R16B03 on Linux, by the way.

Thanks,
Roger.



More information about the erlang-questions mailing list