I need to specify the source port of a UDP message (this is not the same as destination port, but it is the port it a message is sent from). I need to communicate with some professional hardware, it will reply using whatever is the source port of a message.
I had previously worked around this with Poco:
I am wondering if there is another workaround as Poco is not longer part of OF.
As I read (http://serverfault.com/questions/341263/how-are-udp-source-ports-selected) there is difference in the way windows mac and linux will generate source ports for UDP messages). It would be great to rectify this across platforms, I am approaching this problem for something that needs to run on OSX and Windows.
I’ve been in the same situation as you in the past and have done this by binding the to port that I want to remote hardware to respond to, without ofxPoco.
Here I send to port 5555 of the device, the device will reply to my IP address on port 5556.