Allow socket:socket_option() in gen_tcp when inet_backend == socket

The socket module as much more complete, cross platform support for advanced socket options. It would be useful if those options could be used in gen_tcp’s connect and listen methods.

Currently, only the raw options is supported. But the values are platform specific.

1 Like

We do not want compatibility glue in the reverse direction.

If you want the full functionality of the socket API; use the socket API.

If you really need an addition to the gen_tcp socket options make a suggestion that fits the socket option model of the gen_tcp socket options. But remember that these options should preferably be useful on all platforms while the socket options are allowed to be more platform dependent.

1 Like

The problem with the gen_tcp compatibility is that there are a lot of libraries that are using gen_tcp internally (and transparently pass through gen_tcp options). Without the ability to pass socket.erl options through gen_tcp, all of those libraries would need to be changed to use socket.erl before we would be able to use any of the new socket features.

I also wouldn’t want to add new stuff to gen_tcp. The way I would expect the socket option pass through to work is for the old gen_tcp to throw an error if it encounters it and gen_tcp_socket to pass them through to socket.erl.

If a application then needs any of the new socket behavior, it can use {inet_backend, socket} together with new socket options.

1 Like