|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.limegroup.gnutella.UDPService
public class UDPService
This class handles UDP messaging services. It both sends and receives messages, routing received messages to their appropriate handlers. This also handles issues related to the GUESS proposal, such as making sure that the UDP and TCP port match and sending UDP acks for queries.
UDPReplyHandler,
MessageRouter,
QueryUnicaster| Constructor Summary | |
|---|---|
UDPService(NetworkManager networkManager,
com.google.inject.Provider<MessageDispatcher> messageDispatcher,
com.google.inject.Provider<IPFilter> ipFilter,
com.google.inject.Provider<ConnectionManager> connectionManager,
com.google.inject.Provider<MessageRouter> messageRouter,
com.google.inject.Provider<Acceptor> acceptor,
com.google.inject.Provider<QueryUnicaster> queryUnicaster,
ScheduledExecutorService backgroundExecutor,
ConnectionServices connectionServices,
MessageFactory messageFactory,
PingRequestFactory pingRequestFactory,
NetworkInstanceUtils networkInstanceUtils,
EventBroadcaster<FirewallTransferStatusEvent> fwtStatusBroadcaster,
ListenerSupport<UDPSocketChannelConnectionEvent> channelEventListenerSupport)
|
|
| Method Summary | |
|---|---|
boolean |
canDoFWT()
|
boolean |
canReceiveSolicited()
Returns whether or not this node is capable of receiving SOLICITED UDP packets. |
boolean |
canReceiveUnsolicited()
Returns whether or not this node is capable of receiving UNSOLICITED UDP packets. |
GUID |
getConnectBackGUID()
|
long |
getLastReceivedTime()
|
GUID |
getSolicitedGUID()
|
int |
getStableUDPPort()
|
void |
handleIOException(IOException iox)
Notification that an IOException occurred while reading/writing. |
void |
handleRead()
Notification that a read can happen. |
boolean |
handleWrite()
Notification that a write can happen. |
boolean |
isGUESSCapable()
Returns whether or not this node is capable of sending its own GUESS queries. |
boolean |
isListening()
Returns whether or not the UDP socket is listening for incoming messsages. |
int |
lastReportedPort()
|
static void |
mutateGUID(byte[] guid,
InetAddress ip,
int port)
|
DatagramSocket |
newListeningSocket(int port)
Returns a new DatagramSocket that is bound to the given port. |
boolean |
portStable()
|
protected void |
processMessage(Message message,
InetSocketAddress addr)
Processes a single message. |
int |
receivedIpPong()
|
protected void |
scheduleServices()
Schedules IncomingValidator & PeriodicPinger for periodic use. |
void |
send(ByteBuffer buffer,
InetSocketAddress addr,
boolean custom)
|
void |
send(Message msg,
InetAddress ip,
int port)
Sends the Message via UDP to the port and IP address specified. |
void |
send(Message msg,
InetSocketAddress addr)
Sends the specified Message to the specified host. |
void |
send(Message msg,
IpPort host)
Sends the specified Message to the specified host. |
void |
setListeningSocket(DatagramSocket datagramSocket)
Changes the DatagramSocket used for sending/receiving. |
void |
setReceiveSolicited(boolean value)
Sets whether or not this node is capable of receiving SOLICITED UDP packets. |
void |
shutdown()
Shuts down this service. |
void |
start()
Starts listening for UDP messages & allowing UDP messages to be written. |
String |
toString()
Overrides Object.toString to give more informative information about the class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
@Inject
public UDPService(NetworkManager networkManager,
com.google.inject.Provider<MessageDispatcher> messageDispatcher,
com.google.inject.Provider<IPFilter> ipFilter,
com.google.inject.Provider<ConnectionManager> connectionManager,
com.google.inject.Provider<MessageRouter> messageRouter,
com.google.inject.Provider<Acceptor> acceptor,
com.google.inject.Provider<QueryUnicaster> queryUnicaster,
ScheduledExecutorService backgroundExecutor,
ConnectionServices connectionServices,
MessageFactory messageFactory,
PingRequestFactory pingRequestFactory,
NetworkInstanceUtils networkInstanceUtils,
EventBroadcaster<FirewallTransferStatusEvent> fwtStatusBroadcaster,
ListenerSupport<UDPSocketChannelConnectionEvent> channelEventListenerSupport)
| Method Detail |
|---|
protected void scheduleServices()
public GUID getConnectBackGUID()
public GUID getSolicitedGUID()
public void start()
public DatagramSocket newListeningSocket(int port)
throws IOException
IOException - Thrown if the DatagramSocket could not be
created.public void setListeningSocket(DatagramSocket datagramSocket)
datagramSocket - the new listening socket, which must be be the
return value of newListeningSocket(int). A value of null disables
UDP sending and receiving.public void shutdown()
shutdown in interface Shutdownable
public void handleRead()
throws IOException
handleRead in interface ReadObserverIOExceptionpublic void handleIOException(IOException iox)
handleIOException in interface IOErrorObserver
protected void processMessage(Message message,
InetSocketAddress addr)
public static void mutateGUID(byte[] guid,
InetAddress ip,
int port)
public void send(Message msg,
IpPort host)
msg - the Message to sendhost - the host to send the message to
public void send(Message msg,
InetAddress ip,
int port)
msg - the Message to sendip - the InetAddress to send toport - the port to send toerr - an ErrorCallback if you want to be notified errors
IllegalArgumentException - if msg, ip, or err is null.
public void send(Message msg,
InetSocketAddress addr)
msg - the Message to sendhost - the host to send the message to
public void send(ByteBuffer buffer,
InetSocketAddress addr,
boolean custom)
public boolean handleWrite()
throws IOException
handleWrite in interface WriteObservertrue there is still data to be written, otherwise
false.
IOExceptionpublic boolean isGUESSCapable()
public boolean canReceiveUnsolicited()
public boolean canReceiveSolicited()
public boolean canDoFWT()
public boolean portStable()
public int receivedIpPong()
public int lastReportedPort()
public int getStableUDPPort()
public void setReceiveSolicited(boolean value)
public long getLastReceivedTime()
public boolean isListening()
public String toString()
toString in class Object
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||