29.01.2013 Views

Tutorial: Designing Eclipse APIs Boris Bokowski, John Arthorne, Jim ...

Tutorial: Designing Eclipse APIs Boris Bokowski, John Arthorne, Jim ...

Tutorial: Designing Eclipse APIs Boris Bokowski, John Arthorne, Jim ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

But that essentially creates two separate groups<br />

Meet a hackish multicast port redirector (and make sure to run it only on one host pro<br />

network)<br />

public void run() {<br />

while(isRunning) {<br />

try {<br />

byte buf[] = new byte[maxPacketSize];<br />

DatagramPacket packet =<br />

new DatagramPacket(buf, buf.length);<br />

from.receive(packet);<br />

}<br />

int srcPort = packet.getPort();<br />

InetAddress srcAddr = packet.getAddress();<br />

// don't create a loop<br />

if (partnerThread.getLocalPort() == srcPort<br />

&& localhost.equals(srcAddr)) {<br />

continue;<br />

} else {<br />

packet.setAddress(multicastGroup);<br />

packet.setPort(dstPort);<br />

to.send(packet);<br />

} catch (IOException e) {<br />

e.printStackTrace();<br />

}<br />

© 2009 by Markus Alexander Kuppe, Scott Lewis; made available under the EPL v1.0 | March 23, 2009

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!