|
NCSA Portfolio | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ncsa.net.Handler | +--ncsa.net.MulticastHandler
A MulticastHandler sends data to a multicast group. The specified Customer object receives data on that multicast group. The Customer is then responsible for dealing with the incoming data. Usage:
Transform3d transform = InterestingObject.getTransform(); TransformGroupCustomer cust = new TransformGroupCustomer(transform); MulticastHandler multi = new MulticastHandler("128.8.2.2", 3120, cust); multi.begin(); . . . multi.transmit(buf, len); . . . multi.end();In the example above, we wish to send transform information out on a multicast group, and have all other MulticastHandlers listening on the subnet 128.8.2.2 on port 3120 to set the Transform3D for the object InterestingObject when they receive data.
This is used to allow multiple applications working on a subnet to share the same movements. When one application changes a transform and transmits it, all the other applications will change their transforms to match. This object is generally used when many transformations are happening and the user wishes to have continuously updating displays on all subscribed devices.
TransformGroupCustomer
Constructor Summary | |
MulticastHandler(java.lang.String subnet,
int port,
Customer c)
Create a MulticastHandler |
Method Summary | |
void |
begin()
Initialize the multicast socket, and start the receiving thread. |
void |
end()
Stop the receiving thread, and leave the multicast group |
void |
run()
The main thread loop that receives incoming data |
void |
setLoopback(boolean loopback)
Sets the loopback. |
void |
transmit(byte[] buf,
int len)
Send data to the multicast group. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public MulticastHandler(java.lang.String subnet, int port, Customer c)
subnet
- The multicast subnet to broadcast dataport
- The subnet's port to use.c
- The Customer which handles incoming dataMethod Detail |
public void setLoopback(boolean loopback)
loopback
- Whether we want to see stuff we sent or not.public void begin()
public void end()
public void transmit(byte[] buf, int len)
buf
- The outgoing data bufferlen
- The length of data to send.public void run()
|
NCSA Portfolio | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |