object UDPDatagramSocket
Companion object for the UDPDatagramSocket
trait, containing
methods to simplify creation of UDPDatagramSocket
objects, as
well as some useful utility methods. See the documentation for the
UDPDatagramSocket
trait for a full treatment on this API.
- See also
UDPDatagramSocket
- Alphabetic
- By Inheritance
- UDPDatagramSocket
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
apply(): UDPDatagramSocket
Create a UDP datagram socket object that's bound to any available local port and the wildcard IP address.
Create a UDP datagram socket object that's bound to any available local port and the wildcard IP address. The broadcast flag will initially be clear.
- returns
the
UDPDatagramSocket
object
-
def
apply(port: Int): UDPDatagramSocket
Create a UDP datagram socket object that's bound to the specified local port and the wildcard IP address.
Create a UDP datagram socket object that's bound to the specified local port and the wildcard IP address. The broadcast flag will initially be clear.
- port
the local port
- returns
the
UDPDatagramSocket
object
-
def
apply(address: IPAddress, port: Int): UDPDatagramSocket
Create a UDP datagram socket object that's bound to the specified local port and IP address.
Create a UDP datagram socket object that's bound to the specified local port and IP address. The broadcast flag will initially be clear.
- address
the local IP address
- port
the local port
- returns
the
UDPDatagramSocket
object
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
send(bytes: Seq[Byte], address: IPAddress, port: Int, broadcast: Boolean): Unit
Utility method for sending a UDP packet.
Utility method for sending a UDP packet. This method is equivalent to the following code snippet:
// Bind to a local (source) UDP port. val socket = UDPDatagramSocket() val address = IPAddress( /* details omitted */ ) val port: Int = ... val broadcast: Boolean = ... // Set (or clear) the broadcast flag. socket.broadcast = broadcast // Send the bytes to the specified destination address and UDP port. socket.send(bytes, address, port) // Close the socket socket.close()
- bytes
sequence of bytes to send
- address
IP address to which to send bytes
- port
UDP port to which to send bytes
- broadcast
whether or not to enable broadcast on the socket
-
def
send(bytes: Seq[Byte], address: IPAddress, port: Int): Unit
Utility method for sending a non-broadcast UDP packet.
Utility method for sending a non-broadcast UDP packet. This method is equivalent to the following code snippet:
// Bind to a local (source) UDP port. val socket = UDPDatagramSocket.bind() val address = IPAddress( /* details omitted */ ) val port: Int = ... // Send the bytes to the specified destination address and UDP port. socket.send(bytes, address, port) // Close the socket socket.close()
- bytes
sequence of bytes to send
- address
IP address to which to send bytes
- port
UDP port to which to send bytes
-
def
sendString(data: String, encoding: String, address: IPAddress, port: Int, broadcast: Boolean): Unit
Utility method for sending a UDP packet consisting string data.
Utility method for sending a UDP packet consisting string data. The string data is encoded the specified encoding before being sent. This method is equivalent to the following code snippet:
// Bind to a local (source) UDP port. val socket = UDPDatagramSocket() val address = IPAddress( /* details omitted */ ) val port: Int = ... val encoding: String = ... val broadcast: Boolean = ... // Set (or clear) the broadcast flag. socket.broadcast = broadcast // Send the string to the specified destination address and UDP port. socket.send(string, encoding, address, port) // Close the socket socket.close()
- data
String data to send
- encoding
Encoding to use
- address
IP address to which to send bytes
- port
UDP port to which to send bytes
- broadcast
Whether to enable broadcast or not.
-
def
sendString(data: String, address: IPAddress, port: Int, broadcast: Boolean): Unit
Utility method for sending a UDP packet consisting string data.
Utility method for sending a UDP packet consisting string data. The string data is encoded in UTF-8 before being sent. This method is equivalent to the following code snippet:
// Bind to a local (source) UDP port. val socket = UDPDatagramSocket() val address = IPAddress( /* details omitted */ ) val port: Int = ... val broadcast: Boolean = ... // Set (or clear) the broadcast flag. socket.broadcast = broadcast // Send the string to the specified destination address and UDP port. socket.send(string, address, port) // Close the socket socket.close()
- data
String data to send
- address
IP address to which to send bytes
- port
UDP port to which to send bytes
- broadcast
Whether to enable broadcast or not.
-
def
sendString(data: String, address: IPAddress, port: Int): Unit
Utility method for sending a non-broadcast UDP packet consisting of string data.
Utility method for sending a non-broadcast UDP packet consisting of string data. The string data is encoded in UTF-8 before being sent. This method is equivalent to the following code snippet:
// Bind to a local (source) UDP port. val socket = UDPDatagramSocket.bind() val address = IPAddress( /* details omitted */ ) val port: Int = ... // Send the string to the specified destination address and UDP port. socket.send(string, address, port) // Close the socket socket.close()
- data
String data to send
- address
IP address to which to send bytes
- port
UDP port to which to send bytes
-
def
sendString(data: String, encoding: String, address: IPAddress, port: Int): Unit
Utility method for sending a non-broadcast UDP packet consisting of string data.
Utility method for sending a non-broadcast UDP packet consisting of string data. The string data is encoded the specified encoding before being sent. This method is equivalent to the following code snippet:
// Bind to a local (source) UDP port. val socket = UDPDatagramSocket.bind() val address = IPAddress( /* details omitted */ ) val port: Int = ... val encoding: String = ... // Send the string to the specified destination address and UDP port. socket.send(string, encoding, address, port) // Close the socket socket.close()
- data
String data to send
- encoding
Encoding to use
- address
IP address to which to send bytes
- port
UDP port to which to send bytes
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )