Package org.jupnp.transport.impl
Klasse DatagramIOImpl
java.lang.Object
org.jupnp.transport.impl.DatagramIOImpl
- Alle implementierten Schnittstellen:
Runnable,DatagramIO<DatagramIOConfigurationImpl>
Default implementation based on a single shared (receive/send) UDP
MulticastSocket.
Although we do not receive multicast datagrams with this service, sending multicast
datagrams with a configuration time-to-live requires a MulticastSocket.
Thread-safety is guaranteed through synchronization of methods of this service and by the thread-safe underlying socket.
- Autor:
- Christian Bauer, Kai Kreuzer - added configurable port for search responses, Jochen Hiller - add more diagnostic information in case of an general communication exception
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected final DatagramIOConfigurationImplprotected DatagramProcessorprotected InetSocketAddressprotected Routerprotected MulticastSocket -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidinit(InetAddress bindAddress, int bindPort, Router router, DatagramProcessor datagramProcessor) Configures the service and starts any listening sockets.voidrun()voidsend(DatagramPacket datagram) The actual sending of a UDP datagram.voidsend(OutgoingDatagramMessage message) Sends a datagram after conversion withDatagramProcessor.write(org.jupnp.model.message.OutgoingDatagramMessage).voidstop()Stops the service, closes any listening sockets.
-
Felddetails
-
configuration
-
router
-
datagramProcessor
-
localAddress
-
socket
-
-
Konstruktordetails
-
DatagramIOImpl
-
-
Methodendetails
-
getConfiguration
- Angegeben von:
getConfigurationin SchnittstelleDatagramIO<DatagramIOConfigurationImpl>- Gibt zurück:
- This service's configuration.
-
init
public void init(InetAddress bindAddress, int bindPort, Router router, DatagramProcessor datagramProcessor) throws InitializationException Beschreibung aus Schnittstelle kopiert:DatagramIOConfigures the service and starts any listening sockets.- Angegeben von:
initin SchnittstelleDatagramIO<DatagramIOConfigurationImpl>- Parameter:
bindAddress- The port to bind any sockets on. 0 means choosing an ephemeral portrouter- The router which handles receivedIncomingDatagramMessages.datagramProcessor- Reads and writes datagrams.- Löst aus:
InitializationException- If the service could not be initialized or started.
-
stop
public void stop()Beschreibung aus Schnittstelle kopiert:DatagramIOStops the service, closes any listening sockets.- Angegeben von:
stopin SchnittstelleDatagramIO<DatagramIOConfigurationImpl>
-
run
public void run() -
send
Beschreibung aus Schnittstelle kopiert:DatagramIOSends a datagram after conversion withDatagramProcessor.write(org.jupnp.model.message.OutgoingDatagramMessage).- Angegeben von:
sendin SchnittstelleDatagramIO<DatagramIOConfigurationImpl>- Parameter:
message- The message to send.
-
send
Beschreibung aus Schnittstelle kopiert:DatagramIOThe actual sending of a UDP datagram.Recoverable errors should be logged, if appropriate only with debug level. Any non-recoverable errors should be thrown as
RuntimeExceptions.- Angegeben von:
sendin SchnittstelleDatagramIO<DatagramIOConfigurationImpl>- Parameter:
datagram- The UDP datagram to send.
-