Packages

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

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. UDPDatagramSocket
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. 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

  5. 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

  6. 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

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. 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

  19. 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

  20. 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.

  21. 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.

  22. 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

  23. 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

  24. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped