Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should Leshan client port be configurable? #1595

Closed
Ozame opened this issue Mar 21, 2024 · 2 comments
Closed

Should Leshan client port be configurable? #1595

Ozame opened this issue Mar 21, 2024 · 2 comments
Labels
question Any question about leshan

Comments

@Ozame
Copy link

Ozame commented Mar 21, 2024

Question

I noticed that while there used to be a way to specify an IP-port combination for the LeshanClient with setLocalAddress of LeshanClientBuilder, after #1323 there only is an option for specifying the IP address by using org.eclipse.leshan.client.californium.endpoint.CaliforniumClientEndpointsProvider.Builder#setClientAddress .

Is having this kind of option not wanted with the new design? I would guess that while having the OS allocate the port is often the most convenient way, there might be situations where that is not ideal.

Our use case would require that the client would always connect using the same IP address and port. Are there any kind of possible workaround for achieving this?

ps. I'm not sure if this was the right way to have feedback on the transport Layer abstraction, but could not find any issue targeting that specifically.

@Ozame Ozame added the question Any question about leshan label Mar 21, 2024
@sbernard31
Copy link
Contributor

ps. I'm not sure if this was the right way to have feedback on the transport Layer abstraction, but could not find any issue targeting that specifically.

Yep right place, transport layer abstraction is now integrated in master. so it's totally fine to create an issue to discuss about it.

Is having this kind of option not wanted with the new design? I would guess that while having the OS allocate the port is often the most convenient way, there might be situations where that is not ideal.

This is even more complicate than this :
1. A LWM2M client could connect to several server at same time (not implemented by Leshan yet) and setting only 1 port doesn't make too much sense in this case.
2. Also having dynamic port a little benefit. When create a new connection, you will not get message from server which was for previous "connection" (not sure I'm clear)

So we decide to remove this misleading API about fixing the port.
2. is not a real issue.
For 1., I don't know exactly what could be a right API to handle that if we want to support multi-server + fixed port.

Support of multi server is clearly not the priority so maybe this was not a good idea to have remove it now ?

Our use case would require that the client would always connect using the same IP address and port. Are there any kind of possible workaround for achieving this?

At short term, you should be able to choose the port by creating a custom CoapClientEndpointFactory.

@Ozame
Copy link
Author

Ozame commented Apr 12, 2024

Thanks for the clarification. Again this port change is probably one of the things that are only visible when the client/connector is stopped and started.

At short term, you should be able to choose the port by creating a custom CoapClientEndpointFactory.

This will work nicely 👍

@Ozame Ozame closed this as completed Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Any question about leshan
Projects
None yet
Development

No branches or pull requests

2 participants