|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.net.DatagramSocket
|
+--java.net.MulticastSocket
|
+--edu.virginia.cs.mng.hypercast.MulticastSocketMasquerade
A class for easily porting old Java Multicast programs to Hypercast. Ideally, this should be constructed by calling OverlaySocketConfig.createJavaMulticastSocket().
NOTE: Some code may need to be modified if it uses functions:
getInterface, getLocalAddress, getLocalPort,
getTTL, setTTL, and setInterface.
If you want to skip the nice simple interface given by OverlaySocketConfig:
Constructor for MulticastSocket should be replaced by constructor for a MulticastSocketMasquerade.
MulticastSocket sock = new MulticastSocket();
Should become:
MulticastSocket sock = null;
try {
sock = new MulticastSocketMasquerade();
} catch (Exception ignored) {
}
sock.setOLSocket( ... );
At which point, the variable sock can be used as normal.
| Field Summary | |
private IP_Address |
localAddress
The source address for all messages sent by this socket. |
private I_OverlaySocket |
overlaySocket
The socket that messages should be sent to and gotten from. |
(package private) static int |
portNumber
Port number that should be reported. |
| Fields inherited from class java.net.MulticastSocket |
ttlLock |
| Fields inherited from class java.net.DatagramSocket |
connected,
connectedAddress,
connectedPort,
impl,
implClass |
| Constructor Summary | |
MulticastSocketMasquerade()
Create the datagram socket. |
|
| Method Summary | |
void |
close()
leave the group. |
protected void |
finalize()
Ignored. |
java.net.InetAddress |
getInterface()
returns local IP Address. |
java.net.InetAddress |
getLocalAddress()
returns local IP Address. |
int |
getLocalPort()
Returns designated port number (probably zero). |
int |
getSoTimeout()
Returns SoTimeout of Hypercast Socket. |
void |
joinGroup(java.net.InetAddress mcastaddr)
Joins overlay multicast group. |
void |
leaveGroup(java.net.InetAddress mcastaddr)
Leaves overlay multicast group. |
void |
receive(java.net.DatagramPacket p)
Received I_OverlayMessages are translated into DatagramPackets and returned. |
void |
send(java.net.DatagramPacket p)
Datagram Packet is translated into an I_OverlayMessage and sent. |
void |
send(java.net.DatagramPacket p,
byte ttl)
Same as Send, but with specific TTL. |
void |
setInterface(java.net.InetAddress inf)
ignored. |
void |
setOverlaySocket(I_OverlaySocket olSocket)
Sets the socket that messages should be sent over and gotten from. |
void |
setSoTimeout(int timeout)
Sets Hypercast Socket's SoTimeout |
| Methods inherited from class java.net.MulticastSocket |
create,
getTimeToLive,
getTTL,
setTimeToLive,
setTTL |
| Methods inherited from class java.net.DatagramSocket |
|
| Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
| Field Detail |
private I_OverlaySocket overlaySocket
private IP_Address localAddress
static final int portNumber
| Constructor Detail |
public MulticastSocketMasquerade()
throws java.io.IOException
| Method Detail |
public void setOverlaySocket(I_OverlaySocket olSocket)
public void close()
public java.net.InetAddress getInterface()
throws java.net.SocketException
public java.net.InetAddress getLocalAddress()
public int getLocalPort()
public int getSoTimeout()
public void joinGroup(java.net.InetAddress mcastaddr)
throws java.io.IOException
public void leaveGroup(java.net.InetAddress mcastaddr)
throws java.io.IOException
public void receive(java.net.DatagramPacket p)
throws java.io.IOException
public void send(java.net.DatagramPacket p)
throws java.io.IOException
public void send(java.net.DatagramPacket p,
byte ttl)
throws java.io.IOException
ttl - The time to live for this packet
public void setInterface(java.net.InetAddress inf)
throws java.net.SocketException
public void setSoTimeout(int timeout)
throws java.net.SocketException
protected void finalize()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||