|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
This is the interface for a socket to send and receive data on the
overlay. To construct one, see OverlaySocketConfig.createSocket.
Before using the socket, the application must call
joinGroup(). To send data to everyone, follow this
example code:
OverlayManager om = new OverlayManager("hypercast.prop");
OverlaySocketConfig config = om.getOverlaySocketConfig(om.getDefaultProperty("Overlay"));
I_OverlaySocket sock = config.createSocket(null);
sock.joinGroup();
byte[] data = "Hello World!".getBytes();
I_OverlayMessage msg = sock.createMessage(data, data.length);
sock.sendToAll(msg);
| Method Summary | |
I_LogicalAddress |
createLogicalAddress(byte[] laddr,
int offset)
Creates a logical address from a byte array. |
I_OverlayMessage |
createMessage(byte[] payload,
int length)
Create a message for sending on the overlay socket. |
I_LogicalAddress[] |
getChildren(I_LogicalAddress root)
Returns the socket's children's physical/logical address pairs, with respect to the spanning tree rooted at root in the overlay. |
I_LogicalAddress |
getLogicalAddress()
Returns the address of this socket on the overlay. |
I_LogicalAddress[] |
getNeighbors()
Returns the socket's neighbors' physical/logical address pairs. |
I_LogicalAddress |
getParent(I_LogicalAddress root)
Returns the addresspair of the next hop for a message routed by this socket towards the root. |
int |
getSoTimeout()
Get the timeout for any thread calling receive(). |
int |
getTTL()
Gets the default Time-to-Live for all future messages created by createMessage. |
byte[] |
getUniqueIdentifier()
Returns a byte array containing a unique identifier of this socket. |
void |
joinGroup()
Join the overlay multicast group. |
void |
leaveGroup()
Leave the overlay multicast group. |
I_OverlayMessage |
receive()
Receive a message. |
void |
sendFlood(I_OverlayMessage m)
Sends the message to all nodes using a "flood" routing mechanism. |
void |
sendToAll(I_OverlayMessage m)
Sends the message to all members of the overlay topology. |
void |
sendToAllNeighbors(I_OverlayMessage m)
Sends the message one hop to all neighbors of this socket in the overlay. |
void |
sendToChildren(I_OverlayMessage m,
I_LogicalAddress root)
Sends the message one hop to all the children of this socket in the spanning tree rooted at root. |
void |
sendToNode(I_OverlayMessage m,
I_LogicalAddress destla)
Sends the message unicast over the overlay to the destination. |
void |
sendToParent(I_OverlayMessage m,
I_LogicalAddress root)
Sends this message one hop to the parent of this socket in the spanning tree rooted at root. |
void |
setSoTimeout(int timeout)
Set the timeout for any thread calling receive(). |
void |
setTTL(int ttl)
Sets the default Time-to-Live for all future messages created by createMessage. |
| Methods inherited from interface edu.virginia.cs.mng.hypercast.I_Stats |
getSchema,
getStats,
setStats |
| Method Detail |
public void joinGroup()
public void leaveGroup()
public I_OverlayMessage createMessage(byte[] payload,
int length)
public I_LogicalAddress createLogicalAddress(byte[] laddr,
int offset)
public I_LogicalAddress getLogicalAddress()
public byte[] getUniqueIdentifier()
public I_LogicalAddress getParent(I_LogicalAddress root)
root.public I_LogicalAddress[] getChildren(I_LogicalAddress root)
root in the overlay.public I_LogicalAddress[] getNeighbors()
public void setTTL(int ttl)
createMessage. It can be overriden on a
per-message basis by I_OverlayMessage.setTTLpublic int getTTL()
createMessage.public void sendToAll(I_OverlayMessage m)
public void sendToChildren(I_OverlayMessage m,
I_LogicalAddress root)
root. Also
see getChildren.public void sendToAllNeighbors(I_OverlayMessage m)
public void sendToParent(I_OverlayMessage m,
I_LogicalAddress root)
root.
public void sendToNode(I_OverlayMessage m,
I_LogicalAddress destla)
public void sendFlood(I_OverlayMessage m)
public I_OverlayMessage receive()
throws java.io.InterruptedIOException
config.createSocket(null)).
The thread doing this call can be interrupted.
public void setSoTimeout(int timeout)
throws java.net.SocketException
public int getSoTimeout()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||