Tabnine Logo
DatagramChannel.getLocalAddress
Code IndexAdd Tabnine to your IDE (free)

How to use
getLocalAddress
method
in
org.jboss.netty.channel.socket.DatagramChannel

Best Java code snippets using org.jboss.netty.channel.socket.DatagramChannel.getLocalAddress (Showing top 8 results out of 315)

origin: menacher/java-game-server

@Override
public synchronized void close()
{
  if (isClosed)
    return;
  Session session = NettyUDPClient.CLIENTS.remove(channel
      .getLocalAddress());
  if (null == session)
  {
    System.err.println("Possible memory leak occurred. "
        + "The session associated with udp localaddress: "
        + channel.getLocalAddress()
        + " could not be removed from NettyUDPClient.CLIENTS map");
  }
  isClosed = true;
}
origin: menacher/java-game-server

@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
    throws Exception
{
  // Lookup the session from the local address.
  DatagramChannel datagramChannel = (DatagramChannel) e.getChannel();
  Session session = NettyUDPClient.CLIENTS.get(datagramChannel
      .getLocalAddress());
  if (null != session)
  {
    Event event = (Event) e.getMessage();
    // Pass the event on to the session
    session.onEvent(event);
  }
}
origin: menacher/java-game-server

@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
    throws Exception
{
  System.err.println(e.getCause());
  DatagramChannel datagramChannel = (DatagramChannel) e.getChannel();
  Session session = NettyUDPClient.CLIENTS.get(datagramChannel
      .getLocalAddress());
  if (null != session)
  {
    Event event = Events.event(e, Events.EXCEPTION);
    session.onEvent(event);
  }
}
origin: menacher/java-game-server

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
    throws Exception
{
  DatagramChannel datagramChannel = (DatagramChannel) e.getChannel();
  Session session = NettyUDPClient.CLIENTS.get(datagramChannel
      .getLocalAddress());
  if ((null != session) && !session.isShuttingDown())
  {
    Event event = Events.event(e, Events.DISCONNECT);
    session.onEvent(event);
  }
}
origin: menacher/java-game-server

@Override
public void channelDisconnected(ChannelHandlerContext ctx,
    ChannelStateEvent e) throws Exception
{
  DatagramChannel datagramChannel = (DatagramChannel) e.getChannel();
  Session session = NettyUDPClient.CLIENTS.get(datagramChannel
      .getLocalAddress());
  if ((null != session) && !session.isShuttingDown())
  {
    Event event = Events.event(e, Events.DISCONNECT);
    session.onEvent(event);
  }
  else if (null != session)
  {
    System.out.println("Session is already shutting down. "
        + "Disconnect event will be discarded for channel {}"
        + datagramChannel.getId());
  }
}
origin: menacher/java-game-server

CLIENTS.put(datagramChannel.getLocalAddress(), session);
return future;
origin: menacher/java-game-server

final DatagramChannel datagramChannel = udpClient
    .createDatagramChannel();
localAddress = datagramChannel.getLocalAddress();
origin: okleine/nCoAP

/**
 * Returns the local port number the {@link org.jboss.netty.channel.socket.DatagramChannel} of this
 * {@link de.uzl.itm.ncoap.application.client.CoapClient} is bound to or
 * {@link #NOT_BOUND} if the application has not yet been started.
 *
 * @return the local port number the {@link org.jboss.netty.channel.socket.DatagramChannel} of this
 * {@link de.uzl.itm.ncoap.application.client.CoapClient} is bound to or
 * {@link #NOT_BOUND} if the application has not yet been started.
 */
public int getPort() {
  try {
    return this.channel.getLocalAddress().getPort();
  } catch(Exception ex) {
    return NOT_BOUND;
  }
}
org.jboss.netty.channel.socketDatagramChannelgetLocalAddress

Popular methods of DatagramChannel

  • close
  • write
  • getId
  • joinGroup
    Joins the specified multicast group at the specified interface.
  • getFactory
  • getPipeline
  • isBound

Popular in Java

  • Finding current android device location
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getApplicationContext (Context)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now