org.lastbamboo.common.ice
Class MappedTcpOffererServerPool

java.lang.Object
  extended by org.lastbamboo.common.ice.MappedTcpOffererServerPool

public class MappedTcpOffererServerPool
extends Object

This class is a single server socket for all ICE offerers. It works by keeping track of which IP addresses it's expecting incoming sockets from and then associating those with existing ICE negotiations. Users of this class should first check if there are already associated mappings for expected incoming addresses and use alternative means if there are, such as creating a dynamically generated server socket. This class is useful to avoid continually opening and closing server sockets and to avoid constant UPnP and NAP-PMP churn.


Constructor Summary
MappedTcpOffererServerPool(org.lastbamboo.common.portmapping.NatPmpService natPmpService, org.lastbamboo.common.portmapping.UpnpService upnpService, ServerSocketFactory serverSocketFactory)
          Creates a new mapped server for the answerer.
 
Method Summary
 void addServerSocket(PortMappedServerSocket ss)
           
 PortMappedServerSocket serverSocket()
          Accessor for a port-mapped server socket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappedTcpOffererServerPool

public MappedTcpOffererServerPool(org.lastbamboo.common.portmapping.NatPmpService natPmpService,
                                  org.lastbamboo.common.portmapping.UpnpService upnpService,
                                  ServerSocketFactory serverSocketFactory)
Creates a new mapped server for the answerer.

Parameters:
natPmpService - The NAT PMP mapper.
upnpService - The UPnP mapper.
serverAddress - The address of the server.
serverSocketFactory - The factory for creating server sockets -- could be SSL sockets, for example.
Throws:
IOException - If there's an error starting the server.
Method Detail

serverSocket

public PortMappedServerSocket serverSocket()
                                    throws IOException
Accessor for a port-mapped server socket. If there are not cached sockets around, this will create a new one and return it on demand.

Throws:
IOException

addServerSocket

public void addServerSocket(PortMappedServerSocket ss)


Copyright © 2013 LittleShoot. All Rights Reserved.