|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.tomp2p.connection.NATUtils
public class NATUtils
This class is used to do automatic port forwarding. It maps with PMP und UPNP and also unmaps them. It creates a shutdown hook in case the user exits the application without a proper shutdown.
Constructor Summary | |
---|---|
NATUtils()
Constructor. |
Method Summary | |
---|---|
boolean |
mapPMP(int internalPortUDP,
int internalPortTCP,
int externalPortUDP,
int externalPortTCP)
Maps with the PMP protocol (http://en.wikipedia.org/wiki/NAT_Port_Mapping_Protocol). |
boolean |
mapUPNP(String internalHost,
int internalPortUDP,
int internalPortTCP,
int externalPortUDP,
int externalPortTCP)
Maps with UPNP protocol (http://en.wikipedia.org/wiki/Internet_Gateway_Device_Protocol). |
void |
shutdown()
Since shutdown is also called from the shutdown hook, it might get called twice. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NATUtils()
Method Detail |
---|
public boolean mapPMP(int internalPortUDP, int internalPortTCP, int externalPortUDP, int externalPortTCP) throws NatPmpException
internalPortUDP
- The UDP internal portinternalPortTCP
- The TCP internal portexternalPortUDP
- The UDP external portexternalPortTCP
- The TCP external port
NatPmpException
- the router does not supports PMPpublic boolean mapUPNP(String internalHost, int internalPortUDP, int internalPortTCP, int externalPortUDP, int externalPortTCP) throws IOException
internalHost
- The internal host to map the ports tointernalPortUDP
- The UDP internal portinternalPortTCP
- The TCP internal portexternalPortUDP
- The UDP external portexternalPortTCP
- The TCP external port
IOException
- Exceptionpublic void shutdown()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |