Hi, Welcome to the the forums ;).
Yes I remember having issues with the port. If you use QoS beacon, it would not work for me because the port was not set. But my custom one worked quite fine with the code provided above. It is hard to blindly like this tell what went wron on your end. Maybe you can show us your output log.