One process does:
DatagramSocket socket (9666, false); DatagramSocket *newSocket = socket.waitForNextConnection (); if (newSocket) { _DBG ("COnnected"); }
The other one does:
String message ("MESSAGE TO SEND"); DatagramSocket socket (0); socket.connect (destHost->getText(), destPort->getText().getIntValue()); if (socket.isConnected()) { socket.write ((void *)message.toRawUTF8(), message.getNumBytesAsUTF8() + 1); }
The server part never finished, i can see when doing strace() on the process that the messages are getting through:
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 6 bind(6, {sa_family=AF_INET, sin_port=htons(9666), sin_addr=inet_addr("0.0.0.0")}, 16) = 0 select(7, [6], NULL, NULL, NULL) = 1 (in [6]) getsockopt(6, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 recvfrom(6, "", 0, 0, {sa_family=AF_INET, sin_port=htons(41161), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 select(7, [6], NULL, NULL, NULL) = 1 (in [6]) getsockopt(6, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 recvfrom(6, "", 0, 0, {sa_family=AF_INET, sin_port=htons(50030), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 select(7, [6], NULL, NULL, NULL) = 1 (in [6]) getsockopt(6, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 recvfrom(6, "", 0, 0, {sa_family=AF_INET, sin_port=htons(39825), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 select(7, [6], NULL, NULL, NULL) = 1 (in [6]) getsockopt(6, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 recvfrom(6, "", 0, 0, {sa_family=AF_INET, sin_port=htons(58723), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 select(7, [6], NULL, NULL, NULL) = 1 (in [6]) getsockopt(6, SOL_SOCKET, SO_ERROR, [0], [4]) = 0 recvfrom(6, "", 0, 0, {sa_family=AF_INET, sin_port=htons(45439), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 select(7, [6], NULL, NULL, NULL) = 1 (in [6]) getsockopt(6, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
But the method waitForNextConnectionIO never returns so i can't handle the new connection (piece of data since UDP is not connection based)