Setting packet option in ranch

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting packet option in ranch

Roberto Ostinelli-5
All,
I cannot see how to set the {packet, 4} option with ranch.

ranch:start_listener(packet_test, packet_tcp, #{socket_opts => [{packet, 4}, {port, 4444}]}, packet_test, []),

However I get a "Transport option {packet, 4} unknown or invalid" error.

Any pointers?

Thank you,
r.

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Setting packet option in ranch

Loïc Hoguin-3
Transport:setops(Socket, [{packet, 4}]) at the start of your protocol code.

The reason you cannot set it when starting the listener is because that
configuration ought to be independent of the protocol, and packet
options are protocol-dependent.

Cheers,

On 16/10/2019 14:33, Roberto Ostinelli wrote:

> All,
> I cannot see how to set the {packet, 4} option with ranch.
>
> ranch:start_listener(packet_test, packet_tcp, #{socket_opts => [{packet,
> 4}, {port, 4444}]}, packet_test, []),
>
> However I get a "Transport option {packet, 4} unknown or invalid" error.
>
> Any pointers?
>
> Thank you,
> r.
>
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
>

--
Loïc Hoguin
https://ninenines.eu
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Setting packet option in ranch

Roberto Ostinelli-5
Thank you Loïc.

On Wed, Oct 16, 2019 at 2:55 PM Loïc Hoguin <[hidden email]> wrote:
Transport:setops(Socket, [{packet, 4}]) at the start of your protocol code.

The reason you cannot set it when starting the listener is because that
configuration ought to be independent of the protocol, and packet
options are protocol-dependent.

Cheers,

On 16/10/2019 14:33, Roberto Ostinelli wrote:
> All,
> I cannot see how to set the {packet, 4} option with ranch.
>
> ranch:start_listener(packet_test, packet_tcp, #{socket_opts => [{packet,
> 4}, {port, 4444}]}, packet_test, []),
>
> However I get a "Transport option {packet, 4} unknown or invalid" error.
>
> Any pointers?
>
> Thank you,
> r.
>
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
>

--
Loïc Hoguin
https://ninenines.eu

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions