DataDramSocket::write failure

Hi, what are the reasons for this failing to write does anyone know?

I’m getting periods where the call returns -1, and periods when all is ok with nothing changing system wise between the two.

Not sure what could be causing this - any ideas as to why this call might fail?


Some additional info.

This only appears to be a problem when sending to a broadcast address (x.x.255.255) and the error returned is “Host is Down”.

I’m converting some code from an existing Java app - this runs fine and has no problems at all sending to this address.

I can reproduce the problem with this code:

juce::DatagramSocket    send;

char buf[ 5 ];
memcpy( buf, "hello", 5 );

for( int i = 0; i < 1000; i++ ) {
    const int res = send.write( "", 50000, buf, 5 );
    DBG( "send: " << i << ", " << res << ", err: " << errno << ", " << strerror( errno ) );
    juce::Thread::sleep( 100 );

So it turns out the error messages were basically correct. I put a packet sniffer on the network and the packets are definitely not going out over that network card.

If I sent packets to which happens to be a device on that network then they are routed over en0. If I send packets to (i.e the broadcast address) I don’t see them on en0.

Any ideas? thx