com.zink.scala.fly.kit.MulticastRequestor.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scala-lib_2.9.1 Show documentation
Show all versions of scala-lib_2.9.1 Show documentation
Fly Scala is a scala client library for working with a Fly Server. Fly is an object space server that is specifically written to provide lightweight object based messaging between computers running on a network. This distribution does not contain the server, please go to http://www.flyobjectspace.com/ for the server that matches the version of Fly Scala you want to use.
The newest version!
package com.zink.scala.fly.kit
import com.zink.scala.fly.{FlyAccessException, FlyPrime}
import com.zink.scala.fly.FlyAccessException._
import java.net.DatagramPacket
import java.net.InetAddress
import java.net.MulticastSocket
class MulticastRequestor {
private val bytesAddress = Array(232.toByte, 43.toByte, 96.toByte, 232.toByte)
private val ttl = 1
private val sendBytes = "FAB1\n".getBytes
private val multicastAddr = InetAddress.getByAddress(bytesAddress) wrappingExceptionsIn_: FlyAccessException
private val packet = new DatagramPacket(sendBytes, sendBytes.length, multicastAddr, FlyPrime.FLY_PORT) wrappingExceptionsIn_: FlyAccessException
def sendRequest() {
wrapExceptionIfThrown {
val sock = new MulticastSocket()
sock.setTimeToLive(ttl)
sock.send(packet)
sock.close()
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy