All Classes Functions Pages
Public Member Functions | List of all members
libHamCast.MulticastSocket Class Reference

Public Member Functions

 MulticastSocket () throws IOException
 
 MulticastSocket (NetworkMInterface nmi) throws IOException
 
 MulticastSocket (NetworkMInterface[] iter) throws IOException
 
List< Long > getSockInterfaceIDs () throws IOException
 
boolean addInterface (int interfaceID) throws IOException
 
boolean setInterfaces (List< Integer > nmi) throws IOException
 
List< NetworkMInterfacegetInterfaces () throws IOException
 
boolean delInterface (int InterfaceId) throws IOException
 
void join (URI uri) throws IOException
 
void join (String uri) throws URISyntaxException, IOException
 
void leave (String uri) throws IOException, URISyntaxException
 
void leave (URI uri) throws IOException
 
MessageContent receive () throws IOException
 
boolean nonBlockingSend (String uri, byte[] data) throws IOException, URISyntaxException
 
boolean nonBlockingSend (URI uri, byte[] data) throws IOException
 
void flush (String uri_s)
 
void send (String uri, byte[] data) throws IOException, URISyntaxException
 
boolean send (URI uri, byte[] data) throws IOException
 
boolean setTTL (int hops) throws IOException
 
void destroy () throws IOException
 
void finalize ()
 

Detailed Description

implementing class of the MulticastSocket interface, For binding the application to the HAMcast middleware.

Exception-Handling with Runnable

At setCheckConnectionRunnable(Runnable r) you can set the piece of code which will be executed, if an unexpected error occurs. The default exception handler writes an IOException in the java EventQueue. For example, this exception will be appear if the middleware is shutting down while the java api uses it.

Some functions throw IOException - more information with [ExceptionName].getMessage() and at libHamCast.Proxy#checkErr(long, String, String)

See Also
libHamCast.Proxy::checkErr(long, String, String)

Constructor & Destructor Documentation

libHamCast.MulticastSocket.MulticastSocket ( ) throws IOException
Exceptions
IOExceptionif socket couldn't be created
libHamCast.MulticastSocket.MulticastSocket ( NetworkMInterface  nmi) throws IOException
Parameters
nmiexpects an instance NetworkMInterface
Exceptions
IOExceptionif socket could not be created
libHamCast.MulticastSocket.MulticastSocket ( NetworkMInterface[]  iter) throws IOException
Parameters
iterexpects an array of NetworkMInterfaces

Here is the call graph for this function:

Member Function Documentation

boolean libHamCast.MulticastSocket.addInterface ( int  interfaceID) throws IOException
Parameters
nmi- networkMInterface you wish to add
Returns
true, if it was successful
Exceptions
IOException

Here is the call graph for this function:

boolean libHamCast.MulticastSocket.delInterface ( int  InterfaceId) throws IOException

removes an interface from the socket

Warning
use only InterfaceIDs which you got at getAllInterfaces. Wrong Ids lead to UNDEFINDE BEHAVOUR
Exceptions
IOExceptionif interfaces could not be deleted
void libHamCast.MulticastSocket.destroy ( ) throws IOException

removes socket from global list and from socket. This method is responsible for clean destruction of an MulticastSocket object. It informs the HAMcastMiddleware and remove the socket from all global lists.

void libHamCast.MulticastSocket.finalize ( )

*for cleaning purposes

void libHamCast.MulticastSocket.flush ( String  uri_s)
Parameters
uri_s
List<NetworkMInterface> libHamCast.MulticastSocket.getInterfaces ( ) throws IOException
Returns
a List of the Interfaces which are set for this socket.

Here is the call graph for this function:

List<Long> libHamCast.MulticastSocket.getSockInterfaceIDs ( ) throws IOException
Exceptions
IOException
See Also
multicastApi.MulticastSocket::getInterfaces()
void libHamCast.MulticastSocket.join ( URI  uri) throws IOException
See Also
multicastApi.MulticastSocket::join(java.net.URI) join a multicast group
void libHamCast.MulticastSocket.join ( String  uri) throws URISyntaxException, IOException
See Also
multicastApi.MulticastSocket::join(java.lang.String)

Here is the call graph for this function:

void libHamCast.MulticastSocket.leave ( String  uri) throws IOException, URISyntaxException
See Also
multicastApi.MulticastSocket::leave(java.lang.String)
Exceptions
IOException
void libHamCast.MulticastSocket.leave ( URI  uri) throws IOException
See Also
multicastApi.MulticastSocket::leave(java.net.URI)
boolean libHamCast.MulticastSocket.nonBlockingSend ( String  uri,
byte[]  data 
) throws IOException, URISyntaxException
See Also
multicastApi.MulticastSocket::nonBlockingSend(java.lang.String, byte[])
Exceptions
IOException
See Also
Proxy::checkErr(long, String, String)
boolean libHamCast.MulticastSocket.nonBlockingSend ( URI  uri,
byte[]  data 
) throws IOException

For instant sending (doesn't block like send)

Returns
true, if immediate sending was successful
See Also
multicastApi.MulticastSocket::nonBlockingSend(java.net.URI, byte[])
multicastApi.MulticastSocket::send(java.net.URI, byte[])
MessageContent libHamCast.MulticastSocket.receive ( ) throws IOException

is blocked until something is received

See Also
multicastApi.MulticastSocket::receive()

Here is the call graph for this function:

void libHamCast.MulticastSocket.send ( String  uri,
byte[]  data 
) throws IOException, URISyntaxException
See Also
multicastApi.MulticastSocket::send(java.lang.String, byte[])
boolean libHamCast.MulticastSocket.send ( URI  uri,
byte[]  data 
) throws IOException

This method can block if there is not enough free space in the buffer. Use nonBlockingSend for a sending attempt which returns an message of success

Warning
the size of sending bytearrays is limited by technical enviroments to 65k, don't send larger bytearrays.
Exceptions
IOExceptionif Message couldn't be send
InterruptedException
See Also
multicastApi.MulticastSocket::send(java.net.URI, byte[])
boolean libHamCast.MulticastSocket.setInterfaces ( List< Integer >  nmi) throws IOException

overwrites the current interfaces which are used by the socket.

Parameters
nmi- List of Interfaces you wish to set, precondition: nmi is not empty.
Returns
true, if it was successful
Exceptions
IOExceptional
boolean libHamCast.MulticastSocket.setTTL ( int  hops) throws IOException

sets time-to-live if underlaying network supports it.

Returns
true, if middleware understood your request.

The documentation for this class was generated from the following file: