Codota Logo
UdpEndpoint
Code IndexAdd Codota to your IDE (free)

How to use
UdpEndpoint
in
com.jme3.network.kernel.udp

Best Java code snippets using com.jme3.network.kernel.udp.UdpEndpoint (Showing top 15 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: jMonkeyEngine/jmonkeyengine

protected Endpoint getEndpoint( SocketAddress address, boolean create )
{
  UdpEndpoint p = socketEndpoints.get(address);
  if( p == null && create ) {
    p = new UdpEndpoint( this, nextEndpointId(), address, thread.getSocket() );
    socketEndpoints.put( address, p );
    // Add an event for it.
    addEvent( EndpointEvent.createAdd( this, p ) );
  }
  return p;
}
origin: jMonkeyEngine/jmonkeyengine

public void close( boolean flush )
{
  // No real reason to flush UDP traffic yet... especially
  // when considering that the outbound UDP isn't even
  // queued.

  try {
    kernel.closeEndpoint(this);
    connected = false;
  } catch( IOException e ) {
    throw new KernelException( "Error closing endpoint for socket:" + socket, e );
  }
}
origin: jMonkeyEngine/jmonkeyengine

/**
 *  Called by the endpoints when they need to be closed.
 */
protected void closeEndpoint( UdpEndpoint p ) throws IOException
{
  // Just book-keeping to do here.
  if( socketEndpoints.remove( p.getRemoteAddress() ) == null )
    return;
  log.log( Level.FINE, "Closing endpoint:{0}.", p );            
  log.log( Level.FINE, "Socket endpoints size:{0}", socketEndpoints.size() );
  addEvent( EndpointEvent.createRemove( this, p ) );
  wakeupReader();       
}
origin: jMonkeyEngine/jmonkeyengine

/**
 *  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 );
  }
}
origin: jMonkeyEngine/jmonkeyengine

public void send( ByteBuffer data )
{
  if( !isConnected() ) {
    throw new KernelException( "Endpoint is not connected:" + this );
  }
  
  
  try {
    DatagramPacket p = new DatagramPacket( data.array(), data.position(), 
                        data.remaining(), address );
                            // Just queue it up for the kernel threads to write
    // out
    kernel.enqueueWrite( this, p );
                                  //socket.send(p);
  } catch (Exception e) {
    if (e instanceof SocketException) {
      throw new KernelException("Error sending datagram to:" + address, e);
    } else if (e instanceof RuntimeException) {
      throw (RuntimeException) e;
    } else {
      throw new RuntimeException(e);
    }
  }
}
origin: org.jmonkeyengine/jme3-networking

/**
 *  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 );
  }
}
origin: info.projectkyoto/mms-engine

public void send( ByteBuffer data )
{
  if( !isConnected() ) {
    throw new KernelException( "Endpoint is not connected:" + this );
  }
  
  
  try {
    DatagramPacket p = new DatagramPacket( data.array(), data.position(), 
                        data.remaining(), address );
                            // Just queue it up for the kernel threads to write
    // out
    kernel.enqueueWrite( this, p );
                                  //socket.send(p);
  } catch( IOException e ) {
    throw new KernelException( "Error sending datagram to:" + address, e );
  }
}
origin: org.jmonkeyengine/jme3-networking

public void close( boolean flush )
{
  // No real reason to flush UDP traffic yet... especially
  // when considering that the outbound UDP isn't even
  // queued.

  try {
    kernel.closeEndpoint(this);
    connected = false;
  } catch( IOException e ) {
    throw new KernelException( "Error closing endpoint for socket:" + socket, e );
  }
}
origin: org.jmonkeyengine/jme3-networking

protected Endpoint getEndpoint( SocketAddress address, boolean create )
{
  UdpEndpoint p = socketEndpoints.get(address);
  if( p == null && create ) {
    p = new UdpEndpoint( this, nextEndpointId(), address, thread.getSocket() );
    socketEndpoints.put( address, p );
    // Add an event for it.
    addEvent( EndpointEvent.createAdd( this, p ) );
  }
  return p;
}
origin: info.projectkyoto/mms-engine

/**
 *  Called by the endpoints when they need to be closed.
 */
protected void closeEndpoint( UdpEndpoint p ) throws IOException
{
  log.log( Level.INFO, "Closing endpoint:{0}.", p );
    
  // Just book-keeping to do here.
  socketEndpoints.remove( p.getRemoteAddress() );
  addEvent( EndpointEvent.createRemove( this, p ) );
}
origin: info.projectkyoto/mms-engine

/**
 *  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 );
  }
}
origin: org.jmonkeyengine/jme3-networking

public void send( ByteBuffer data )
{
  if( !isConnected() ) {
    throw new KernelException( "Endpoint is not connected:" + this );
  }
  
  
  try {
    DatagramPacket p = new DatagramPacket( data.array(), data.position(), 
                        data.remaining(), address );
                            // Just queue it up for the kernel threads to write
    // out
    kernel.enqueueWrite( this, p );
                                  //socket.send(p);
  } catch (Exception e) {
    if (e instanceof SocketException) {
      throw new KernelException("Error sending datagram to:" + address, e);
    } else if (e instanceof RuntimeException) {
      throw (RuntimeException) e;
    } else {
      throw new RuntimeException(e);
    }
  }
}
origin: info.projectkyoto/mms-engine

public void close( boolean flush )
{
  // No real reason to flush UDP traffic yet... especially
  // when considering that the outbound UDP isn't even
  // queued.

  try {
    kernel.closeEndpoint(this);
    connected = false;
  } catch( IOException e ) {
    throw new KernelException( "Error closing endpoint for socket:" + socket, e );
  }
}
origin: info.projectkyoto/mms-engine

protected Endpoint getEndpoint( SocketAddress address, boolean create )
{
  UdpEndpoint p = socketEndpoints.get(address);
  if( p == null && create ) {
    p = new UdpEndpoint( this, nextEndpointId(), address, thread.getSocket() );
    socketEndpoints.put( address, p );
    // Add an event for it.
    addEvent( EndpointEvent.createAdd( this, p ) );
  }
  return p;
}
origin: org.jmonkeyengine/jme3-networking

/**
 *  Called by the endpoints when they need to be closed.
 */
protected void closeEndpoint( UdpEndpoint p ) throws IOException
{
  // Just book-keeping to do here.
  if( socketEndpoints.remove( p.getRemoteAddress() ) == null )
    return;
  log.log( Level.FINE, "Closing endpoint:{0}.", p );            
  log.log( Level.FINE, "Socket endpoints size:{0}", socketEndpoints.size() );
  addEvent( EndpointEvent.createRemove( this, p ) );
  wakeupReader();       
}
com.jme3.network.kernel.udpUdpEndpoint

Javadoc

Endpoint implementation that encapsulates the UDP connection information for return messaging, identification of envelope sources, etc.

Most used methods

  • <init>
  • close
  • getRemoteAddress
  • isConnected
  • send

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now