the syntax of the udp manager class is kind of strange. upd is not a connection oriented protocol, that means that although you call connect in one of the sides, that it’s only storing the ip an port to which messages will be sent later, also since there’s no real connection the listening side doesn’t know where to send the messages.
in order to be able to send and receive on both sides you need to call both Bind and connect in both managers, also if both are running in the same machine you can’t use the same port when binding and one has to connect to the port that the other is binding
Thank you for your reply, that’s pretty clear. The weird thing is that when i setup the ofxUDPManager object like in my previous post, and i receive a message via the function bellow i’m not able anymore to send something (before receiving anything the sending works) the only solution i found is to recall “udpConnection.Connect(“192.168.1.255”,11007);” just after receiving something, but it’s not elegant at all isn’t it ? is it a bug ?
Thank you again for your help. Indeed you example works fine. For my project, i need to broadcast message on a local network and i receive from multiple devices on this same local network (this devices broadcast the UDP message too).
Anyway, when I try the code bellow, when I press a key for the first time the message is well sent and received, but when i press again the key, the message is not sent. The weird thing is that it seems send and received looking at the output generated by ofLogError(), but when i sniff the network i see the first key pressed sent, but not the others.
If i manage this with two ofxUDPManager object (one for send and the other for receive) it works, but regarding your advise it must work too with only one ofxUDPManager object.
with the code in my last post, by sniffing the network, it seems that the destination port of the sender change after receiving data this is why nobody on the network receive nothing after receiving the first udp packet, so it’s a bit weird. If you have any clue i’ll be really interested.
And sorry for the late reply.
So here is a project with the issue. To reproduce the bug i use “hercule” to receive and send the UDP on another computer that the one running the of application, and i first send an UDP form the of app to the distant computer. Then if i try again, the distant computer didn’t receive anything unless i send something form the distant computer to the of app then it works again. http://we.tl/nqjK5yjxOx
Thank you again for you help on this subject.