tuwien.auto.eicl
Class Discoverer
java.lang.Object
tuwien.auto.eicl.Discoverer
- Runnable
public class Discoverer
extends java.lang.Object
implements Runnable
The Discoverer class handles EIBnet/IP search and description requests. To be
able to accept search and description responses, this class maintains its own
socket and runs as an independent thread. This is, however, not of concern
for the client application since thread instantiation is done implicitly in
the constructor.
Discoverer() - Opens a new socket with a random port number and establishes the new
instance as a receiver thread.
|
Discoverer(int _LocalPort) - Opens a socket on the given port and establishes the new instance as a
receiver thread.
|
Description_Response | getDescription(InetSocketAddress _SocketAddress, int _Timeout) - Sends a description request message and blocks until either the answer
has been received or the timeout is reached.
|
InetSocketAddress[] | getSearchResponses() - Returns the socket addresses of the hosts that have answered the search
request.
|
void | run() - The run method is responsible for receiving search and description
messages.
|
void | sendSearchRequest() - Sends a search request message (multicast).
|
Discoverer
public Discoverer()
Opens a new socket with a random port number and establishes the new
instance as a receiver thread. If something goes wrong an Exception is
thrown.
Discoverer
public Discoverer(int _LocalPort)
throws EICLException
Opens a socket on the given port and establishes the new instance as a
receiver thread.
_LocalPort
- the socket port
getDescription
public Description_Response getDescription(InetSocketAddress _SocketAddress,
int _Timeout)
throws EICLException
Sends a description request message and blocks until either the answer
has been received or the timeout is reached. If the timeout is reached an
Exception is thrown.
_SocketAddress
- The server socket address_Timeout
- Timeout (in seconds)
- The description response message
EICLException
- If the timeout was reached or something went wrong
getSearchResponses
public InetSocketAddress[] getSearchResponses()
Returns the socket addresses of the hosts that have answered the search
request. You can invoke this method multiple times to check for new
responses, only a new search request will erase the list of responses.
run
public void run()
The run method is responsible for receiving search and description
messages. It therefore blocks on the socket until a message arrives. It's
not necessary to call it on your own; this is done by the constructor.
sendSearchRequest
public void sendSearchRequest()
throws EICLException
Sends a search request message (multicast). The results can be accessed
with the getSearchResponses() method. Note that a new search request
causes getSearchResponses to forget previously received responses.