среда, 1 августа 2012 г.

distributed: udp

    UDP

    IP (multicast/broadcast)
    A multicast group is specified by a class D IP address and by a standard UDP port number
    Class D IP addresses are in the range 224.0.0.0 to 239.255.255.255, inclusive. The address 224.0.0.0 is reserved and should not be used.

    For host specified in literal IPv6 address, either the form defined in RFC 2732 or the literal IPv6 address format defined in RFC 2373 is accepted. IPv6 scoped addresses are also supported. See here for a description of IPv6 scoped addresses. If the host is null then an InetAddress representing an address of the loopback interface is returned. See RFC 3330 section 2 and RFC 2373 section 2.5.3. [InetAddress.getByName(String)]


    Unicast

    Multicast
    Multicast is a special protocol for use with IP. Multicast enables a single device to communicate with a specific set of hosts, not defined by any standard IP address and mask combination. This allows for communication that resembles a conference call. Anyone from anywhere can join the conference, and everyone at the conference hears what the speaker has to say. The speaker's message isn't broadcasted everywhere, but only to those in the conference call itself. A special set of addresses is used for multicast communication.
    A MulticastSocket is a (UDP) DatagramSocket, with additional capabilities for joining "groups" of other multicast hosts on the internet.
    "... host OS IGMP stacks and other multicast infrastructure complications"?
    Multicast - A transmission to a group of interface cards on the network. 

    Broadcast
    Broadcast is when a single device is transmitting a message to all other devices in a given address range. This broadcast could reach all hosts on the subnet, all subnets, or all hosts on all subnets. Broadcast packets have the host (and/or subnet) portion of the address set to all ones. By design, most modern routers will block IP broadcast traffic and restrict it to the local subnet.
    Broadcast - A transmission to all interface cards on the network. RFC 919 and 922 describe IP broadcast datagrams.
    Limited Broadcast - Sent to all NICs on the some network segment as the source NIC. It is represented with the 255.255.255.255 TCP/IP address. This broadcast is not forwarded by routers so will only appear on one network segment. 
    Direct broadcast - Sent to all hosts on a network. Routers may be configured to forward directed broadcasts on large networks. For network 192.168.0.0, the broadcast is 192.168.255.255
    In order to receive broadcast packets a DatagramSocket should be bound to the wildcard address.
    In some implementations, broadcast packets may also be received when a DatagramSocket is bound to a more specific address?
- SO_RCVBUF

SO_REUSEADDR
SO_SNDBUFSO_TIMEOUTSO_BROADCAST
TrafficClass / IP_TOS

java.nio.channels.DatagramChannel
Datagram channels are safe for use by multiple concurrent threads. They support concurrent reading and writing, though at most one thread may be reading and at most one thread may be writing at any given time.