Open kamrup opened 2 years ago
Binding to a random port is generally not well supported or documented yet, but I'm open to adding that.
I think it should work the same way on Windows in principle, but what makes it break with you concrete approach is that due to Windows' lack of PKTINFO, the server and client portion of the context uses different socket(s), so the server's port is inaccessible through the client socket obtained through find_remote_and_interface.
I'm using
aiocoap
in a test setup where I would like to create a server context bound to a random port. The device I'm testing should then send requests to that server, but how do I get the server port?Example:
On Windows I haven't found a way to get it, but on Linux I can get it using the following piece of code, but I guess that's not how you're supposed to do it:
Output of
python3 -m aiocoap.cli.defaults
:Windows:
Linux: