I'm analyzing both codes, and till now I haven't take any relevant conclusion, both should work. I will continue analyzing.
I've tested the same network setup with a client implementation in the xdk and it worked perfectly, so I think that the network isn't the problem. I saw that
post of Manuel Bock some weeks ago, but I think my issue is different.
I hope to hear from you soon!
Thank you very much for all your answers!
Now that we got this working offline with the help of others, for the benefit of the Community I will soon post that modified code, and then check about updating the documentation. Thanks for bringing attention to this! With ongoing releases, your input is helpful for always improving the docs.
If there were any other code suggestions or question you had, please feel free to update the post.