|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.net.DatagramSocket | +--java.net.MulticastSocket | +--hypercast.MulticastSocketMasquerade
A class for easily porting old Java Multicast programs to Hypercast. Ideally, this should be constructed by calling HyperCastConfig.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 HyperCastConfig:
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.
Constructor Summary | |
MulticastSocketMasquerade()
Create the datagram socket. |
Method Summary | |
void |
close()
leave the group. |
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 |
setInterface(java.net.InetAddress inf)
ignored. |
void |
setOverlaySocket(hypercast.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 |
getLoopbackMode, getNetworkInterface, getTimeToLive, getTTL, joinGroup, leaveGroup, send, setLoopbackMode, setNetworkInterface, setTimeToLive, setTTL |
Methods inherited from class java.net.DatagramSocket |
bind, connect, connect, disconnect, getBroadcast, getChannel, getInetAddress, getLocalSocketAddress, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getTrafficClass, isBound, isClosed, isConnected, setBroadcast, setDatagramSocketImplFactory, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setTrafficClass |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MulticastSocketMasquerade() throws java.io.IOException
java.io.IOException
- This should be caught and ignored.Method Detail |
public void setOverlaySocket(hypercast.I_OverlaySocket olSocket)
public void close()
close
in class java.net.DatagramSocket
public java.net.InetAddress getInterface() throws java.net.SocketException
getInterface
in class java.net.MulticastSocket
java.net.SocketException
public java.net.InetAddress getLocalAddress()
getLocalAddress
in class java.net.DatagramSocket
public int getLocalPort()
getLocalPort
in class java.net.DatagramSocket
public int getSoTimeout()
getSoTimeout
in class java.net.DatagramSocket
public void joinGroup(java.net.InetAddress mcastaddr) throws java.io.IOException
joinGroup
in class java.net.MulticastSocket
java.io.IOException
public void leaveGroup(java.net.InetAddress mcastaddr) throws java.io.IOException
leaveGroup
in class java.net.MulticastSocket
java.io.IOException
public void receive(java.net.DatagramPacket p) throws java.io.IOException
receive
in class java.net.DatagramSocket
java.io.IOException
- is never thrown.public void send(java.net.DatagramPacket p) throws java.io.IOException
send
in class java.net.DatagramSocket
java.io.IOException
- is never thrown.public void setInterface(java.net.InetAddress inf) throws java.net.SocketException
setInterface
in class java.net.MulticastSocket
java.net.SocketException
public void setSoTimeout(int timeout) throws java.net.SocketException
setSoTimeout
in class java.net.DatagramSocket
java.net.SocketException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |