erotsppa
erotsppa

Reputation: 15061

What is the meaning of child.connectTimeoutMillis in Netty's configuration?

What does this do in netty?

bootstrap.setOption("child.connectTimeoutMillis", x);

Upvotes: 2

Views: 3441

Answers (2)

biasedbit
biasedbit

Reputation: 2870

"child.connectionTimeoutMillis" won't do anything, neither for ClientBootstrap nor for ServerBootstrap.

It's a client option so it should be used only as "connectionTimeoutMillis" (without the "child." part) on ClientBootstrap instances.

What option do I need to keep all my clients persisted forever (no time out)?

Use "child.keepAlive" for ServerBootstrap and "keepAlive" for ClientBootstrap.

Upvotes: 6

GuruKulki
GuruKulki

Reputation: 26428

public void setOption(String key, Object value)

Sets an option with the specified key and value. If there's already an option with the same key, it is replaced with the new value. If the specified value is null, an existing option with the specified key is removed. To set the option value of a child Channel, prepend "child." to the option name (e.g. "child.keepAlive").

Parameters:

key - the option name

value - the option value

And bootstrap.setOption("child.connectTimeoutMillis", x); sets the Connect timeout of the channel(in this case child's channel) in milliseconds. If you set the value to 0, it disables the Timeout Option.

Upvotes: -1

Related Questions