IT. Expert System.

Android Reference

MulticastSocket


java.net

Class MulticastSocket



  • public class MulticastSocket
    extends DatagramSocket
    This class implements a multicast socket for sending and receiving IP multicast datagram packets.
    See Also:
    DatagramSocket
    • Constructor Detail

      • MulticastSocket

        public MulticastSocket()
                        throws IOException
        Constructs a multicast socket, bound to any available port on the local host.
        Throws:
        IOException - if an error occurs.
      • MulticastSocket

        public MulticastSocket(int port)
                        throws IOException
        Constructs a multicast socket, bound to the specified port on the local host.
        Throws:
        IOException - if an error occurs.
      • MulticastSocket

        public MulticastSocket(SocketAddress localAddress)
                        throws IOException
        Constructs a MulticastSocket bound to the address and port specified by localAddress, or an unbound MulticastSocket if localAddress == null.
        Throws:
        IllegalArgumentException - if localAddress is not supported (because it's not an InetSocketAddress, say).
        IOException - if an error occurs.
    • Method Detail

      • getTimeToLive

        public int getTimeToLive()
                          throws IOException
        Returns the time-to-live (TTL) for multicast packets sent on this socket.
        Throws:
        IOException - if an error occurs.
      • joinGroup

        public void joinGroup(InetAddress groupAddr)
                       throws IOException
        Adds this socket to the specified multicast group. A socket must join a group before data may be received. A socket may be a member of multiple groups but may join any group only once.
        Parameters:
        groupAddr - the multicast group to be joined.
        Throws:
        IOException - if an error occurs.
      • joinGroup

        public void joinGroup(SocketAddress groupAddress,
                     NetworkInterface netInterface)
                       throws IOException
        Adds this socket to the specified multicast group. A socket must join a group before data may be received. A socket may be a member of multiple groups but may join any group only once.
        Parameters:
        groupAddress - the multicast group to be joined.
        netInterface - the network interface on which the datagram packets will be received.
        Throws:
        IOException - if the specified address is not a multicast address.
        IllegalArgumentException - if no multicast group is specified.
      • leaveGroup

        public void leaveGroup(InetAddress groupAddr)
                        throws IOException
        Removes this socket from the specified multicast group.
        Parameters:
        groupAddr - the multicast group to be left.
        Throws:
        NullPointerException - if groupAddr is null.
        IOException - if the specified group address is not a multicast address.
      • leaveGroup

        public void leaveGroup(SocketAddress groupAddress,
                      NetworkInterface netInterface)
                        throws IOException
        Removes this socket from the specified multicast group.
        Parameters:
        groupAddress - the multicast group to be left.
        netInterface - the network interface on which the addresses should be dropped.
        Throws:
        IOException - if the specified group address is not a multicast address.
        IllegalArgumentException - if groupAddress is null.
      • send

        @Deprecated
        public void send(DatagramPacket packet,
                           byte ttl)
                  throws IOException
        Deprecated. use setTimeToLive(int).
        Sends the given packet on this socket, using the given ttl. This method is deprecated because it modifies the TTL socket option for this socket twice on each call.
        Throws:
        IOException - if an error occurs.
      • setInterface

        public void setInterface(InetAddress address)
                          throws SocketException
        Sets the outgoing network interface used by this socket. The interface used is the first interface found to have the given address. To avoid inherent unpredictability, new code should use getNetworkInterface() instead.
        Throws:
        SocketException - if an error occurs.
      • setTimeToLive

        public void setTimeToLive(int ttl)
                           throws IOException
        Sets the time-to-live (TTL) for multicast packets sent on this socket. Valid TTL values are between 0 and 255 inclusive.
        Throws:
        IOException - if an error occurs.
      • setTTL

        @Deprecated
        public void setTTL(byte ttl)
                    throws IOException
        Deprecated. Replaced by setTimeToLive(int)
        Sets the time-to-live (TTL) for multicast packets sent on this socket. Valid TTL values are between 0 and 255 inclusive.
        Throws:
        IOException - if an error occurs.
      • setLoopbackMode

        public void setLoopbackMode(boolean disable)
                             throws SocketException
        Disables multicast loopback if disable == true. See SocketOptions.IP_MULTICAST_LOOP, and note that the sense of this is the opposite of the underlying Unix IP_MULTICAST_LOOP.
        Throws:
        SocketException - if an error occurs.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 197 / 158695348. Delta: 0.03434 с