Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jempeg.empeg.protocol
Class NetworkEmpegDiscoverer  view NetworkEmpegDiscoverer download NetworkEmpegDiscoverer.java

java.lang.Object
  extended byorg.jempeg.empeg.protocol.AbstractEmpegDiscoverer
      extended byorg.jempeg.empeg.protocol.NetworkEmpegDiscoverer

public class NetworkEmpegDiscoverer
extends AbstractEmpegDiscoverer

NetworkEmpegDiscoverer implements discovery over a Socket-based TCP/IP network. Discovery is based on broadcasting a datagram to over port 8300 and listening for the Empeg to respond.

Version:
2.0a1 $Date: 2002/01/10 02:48:26 $

Nested Class Summary
protected  class NetworkEmpegDiscoverer.BroadcastRunnable
           
 
Field Summary
private static int DISCOVERY_PORT
           
private static java.lang.String DISCOVERY_STRING
           
private static int MAX_RETRIES
           
private  java.lang.String myDoNotBroadcastTo
           
 
Fields inherited from class org.jempeg.empeg.protocol.AbstractEmpegDiscoverer
 
Constructor Summary
NetworkEmpegDiscoverer()
          Constructs a new NetworkEmpegDiscoverer using 255.255.255.255 as the broadcast address.
 
Method Summary
protected  void broadcastDiscoveryRequest(java.net.DatagramSocket _socket, java.net.InetAddress _broadcastAddress)
           
static SocketConnection createConnection(java.net.InetAddress _inetAddress)
          Creates a SocketConnection based on the given InetAddress
 boolean discover(int _timeoutMillis)
          Implemented by subclasses.
static void main(java.lang.String[] _args)
           
protected  boolean parseDiscoveryResponse(java.net.DatagramPacket _packet)
           
 void setDoNotBroadcastTo(java.lang.String _doNotBroadcastTo)
          Sets a comma-separated list of broadcast addresses to not broadcast on.
protected  boolean waitForDiscoveryResponses(java.net.DatagramSocket _socket, int _timeoutMillis, java.util.Vector _discoveredVec)
           
 
Methods inherited from class org.jempeg.empeg.protocol.AbstractEmpegDiscoverer
addEmpegDiscovererListener, fireEmpegDiscovered, fireEmpegDiscovered, getEmpegName, getPlayerType, isEmpegConnected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISCOVERY_PORT

private static final int DISCOVERY_PORT
See Also:
Constant Field Values

MAX_RETRIES

private static final int MAX_RETRIES
See Also:
Constant Field Values

DISCOVERY_STRING

private static final java.lang.String DISCOVERY_STRING
See Also:
Constant Field Values

myDoNotBroadcastTo

private java.lang.String myDoNotBroadcastTo
Constructor Detail

NetworkEmpegDiscoverer

public NetworkEmpegDiscoverer()
                       throws java.io.IOException
Constructs a new NetworkEmpegDiscoverer using 255.255.255.255 as the broadcast address.

Method Detail

createConnection

public static SocketConnection createConnection(java.net.InetAddress _inetAddress)
                                         throws java.io.IOException
Creates a SocketConnection based on the given InetAddress


setDoNotBroadcastTo

public void setDoNotBroadcastTo(java.lang.String _doNotBroadcastTo)
Sets a comma-separated list of broadcast addresses to not broadcast on. This is an optimization if someone has a NIC that they KNOW will not have an Empeg on it.


discover

public boolean discover(int _timeoutMillis)
                 throws java.io.IOException
Description copied from class: AbstractEmpegDiscoverer
Implemented by subclasses. This will actually perform the subclass-dependent mechanism of finding an Empeg (within the given timeout time)

Specified by:
discover in class AbstractEmpegDiscoverer

broadcastDiscoveryRequest

protected void broadcastDiscoveryRequest(java.net.DatagramSocket _socket,
                                         java.net.InetAddress _broadcastAddress)
                                  throws java.io.IOException

waitForDiscoveryResponses

protected boolean waitForDiscoveryResponses(java.net.DatagramSocket _socket,
                                            int _timeoutMillis,
                                            java.util.Vector _discoveredVec)
                                     throws java.io.IOException

parseDiscoveryResponse

protected boolean parseDiscoveryResponse(java.net.DatagramPacket _packet)
                                  throws java.io.IOException

main

public static void main(java.lang.String[] _args)
                 throws java.lang.Throwable