/** * Dispatches the data to all endpoints managed by the * kernel. 'routing' is currently ignored. */ public void broadcast( Filter<? super Endpoint> filter, ByteBuffer data, boolean reliable, boolean copy ) { if( reliable ) throw new UnsupportedOperationException( "Reliable send not supported by this kernel." ); if( copy ) { // Copy the data just once byte[] temp = new byte[data.remaining()]; System.arraycopy(data.array(), data.position(), temp, 0, data.remaining()); data = ByteBuffer.wrap(temp); } // Hand it to all of the endpoints that match our routing for( UdpEndpoint p : socketEndpoints.values() ) { // Does it match the filter? if( filter != null && !filter.apply(p) ) continue; // Send the data p.send( data ); } }
/** * Dispatches the data to all endpoints managed by the * kernel. 'routing' is currently ignored. */ public void broadcast( Filter<? super Endpoint> filter, ByteBuffer data, boolean reliable, boolean copy ) { if( reliable ) throw new UnsupportedOperationException( "Reliable send not supported by this kernel." ); if( copy ) { // Copy the data just once byte[] temp = new byte[data.remaining()]; System.arraycopy(data.array(), data.position(), temp, 0, data.remaining()); data = ByteBuffer.wrap(temp); } // Hand it to all of the endpoints that match our routing for( UdpEndpoint p : socketEndpoints.values() ) { // Does it match the filter? if( filter != null && !filter.apply(p) ) continue; // Send the data p.send( data ); } }
/** * Dispatches the data to all endpoints managed by the * kernel. 'routing' is currently ignored. */ public void broadcast( Filter<? super Endpoint> filter, ByteBuffer data, boolean reliable, boolean copy ) { if( reliable ) throw new UnsupportedOperationException( "Reliable send not supported by this kernel." ); if( copy ) { // Copy the data just once byte[] temp = new byte[data.remaining()]; System.arraycopy(data.array(), data.position(), temp, 0, data.remaining()); data = ByteBuffer.wrap(temp); } // Hand it to all of the endpoints that match our routing for( UdpEndpoint p : socketEndpoints.values() ) { // Does it match the filter? if( filter != null && !filter.apply(p) ) continue; // Send the data p.send( data ); } }