Files
spring-integration/spring-integration-samples/loanshark/udps.groovy
2010-03-29 20:01:20 +00:00

13 lines
368 B
Groovy

//Groovy Script to catch multicast packets.
socket = new MulticastSocket(11111)
mcast = InetAddress.getByName("225.6.7.8")
socket.joinGroup(mcast)
buffer = (' ' * 1024) as byte[]
while(true) {
incoming = new DatagramPacket(buffer, buffer.length)
socket.receive(incoming)
s = new String(incoming.data, 0, incoming.length)
println ("** Shark **" + s)
}