package java.nio.channels;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.io.IOException;
/**
* A token representing the membership of an Internet Protocol (IP) multicast
* group.
*MembershipKey表示一个网络IP协议的多播分组成员信息token
* <p> A membership key may represent a membership to receive all datagrams sent
* to the group, or it may be [i]source-specific[/i], meaning that it
* represents a membership that receives only datagrams from a specific source
* address. Whether or not a membership key is source-specific may be determined
* by invoking its {@link #sourceAddress() sourceAddress} method.
*一个MembershipKey表示一个多播组成员接受发送到多播组的报文的关系,如果源地址确定,
表示直接接受来至源地址的报文。我们可以通过#sourceAddress来判断源地址是否确定。
* <p> A membership key is valid upon creation and remains valid until the
* membership is dropped by invoking the {@link #drop() drop} method, or
* the channel is closed. The validity of the membership key may be tested
* by invoking its {@link #isValid() isValid} method.
*一个多播组成员关系在创建时,是有效的,直到MembershipKey调用#drop方法,之前他都是有效。
我们可以调用#isValid()来判断其是否有效。
* <p> Where a membership key is not source-specific and the underlying operation
* system supports source filtering, then the {@link #block block} and {@link
* #unblock unblock} methods can be used to block or unblock multicast datagrams
* from particular source addresses.
*如果MembershipKey的源地址是不确定的,底层操作系统支持源地址过滤,调用#block和#unblock将会
阻塞和解除阻塞从源地址发送过来的报文
* @see MulticastChannel
*
* @since 1.7
*/
public abstract class MembershipKey {
/**
* Initializes a new instance of this class.
*/
protected MembershipKey() {
}
/**
* Tells whether or not this membership is valid.
*判断一个MembershipKey是否有效
* <p> A multicast group membership is valid upon creation and remains
* valid until the membership is dropped by invoking the {@link #drop() drop}
* method, or the channel is closed.
*一个多播组成员关系在创建时,是有效的,直到MembershipKey调用#drop方法,之前他都是有效。
* @return {@code true} if this membership key is valid, {@code false}
* otherwise
*/
public abstract boolean isValid();
/**
* Drop membership.
*丢弃组成员关系membership
* <p> If the membership key represents a membership to receive all datagrams
* then the membership is dropped and the channel will no longer receive any
* datagrams sent to the group. If the membership key is source-specific
* then the channel will no longer receive datagrams sent to the group from
* that source address.
*如果MembershipKey表示,MembershipKey接受所有报文,当drop方法调用时,通道不在接受
任何报文发送给多播组。如果MembershipKey的源地址是确定的,那么通道不在接受
任何报文发送给源地址的多播组。
* <p> After membership is dropped it may still be possible to receive
* datagrams sent to the group. This can arise when datagrams are waiting to
* be received in the socket's receive buffer. After membership is dropped
* then the channel may {@link MulticastChannel#join join} the group again
* in which case a new membership key is returned.
*在多播成员关系drop之后,仍有可能接受发送到多播组的报文。则个可能引起socket的接收
缓冲区的报文等待被接收。在多播成员关系drop之后,通道有可能调用MulticastChannel#join
方法加入分组,这样一个新的MembershipKey将会被创建返回。
* <p> Upon return, this membership object will be {@link #isValid() invalid}.
* If the multicast group membership is already invalid then invoking this
* method has no effect. Once a multicast group membership is invalid,
* it remains invalid forever.
drop多播成员关系drop之后,#isValid()方法将会返回fasle,即无效。如果MembershipKey已经无效,
则调用此方将没有任何影响。一旦多播关系为无效的,则永久无效。
*/
public abstract void drop();
/**
* Block multicast datagrams from the given source address.
*阻塞从源地址发送过来的多播报文
* <p> If this membership key is not source-specific, and the underlying
* operating system supports source filtering, then this method blocks
* multicast datagrams from the given source address. If the given source
* address is already blocked then this method has no effect.
* After a source address is blocked it may still be possible to receive
* datagams from that source. This can arise when datagrams are waiting to
* be received in the socket's receive buffer.
*如果MembershipKey的源地址是不确定的,底层操作系统支持源地址过滤,此方法将会
阻塞从源地址发送过来的多播报文。如果源地址已经被阻塞,再次调用任何影响。
在源地址阻塞后,仍有可能接受源地址的报文。则个可能引起socket的接收
缓冲区中的报文等待被接收。
* @param source
* The source address to block
*
* @return This membership key
*
* @throws IllegalArgumentException
* If the {@code source} parameter is not a unicast address or
* is not the same address type as the multicast group
* @throws IllegalStateException
* If this membership key is source-specific or is no longer valid
* @throws UnsupportedOperationException
* If the underlying operating system does not support source
* filtering
* @throws IOException
* If an I/O error occurs
*/
public abstract MembershipKey block(InetAddress source) throws IOException;
/**
* Unblock multicast datagrams from the given source address that was
* previously blocked using the {@link #block(InetAddress) block} method.
*解除从源地址发送过来多播报文的阻塞
* @param source
* The source address to unblock
*
* @return This membership key
*
* @throws IllegalStateException
* If the given source address is not currently blocked or the
* membership key is no longer valid
*/
public abstract MembershipKey unblock(InetAddress source);
/**
* Returns the channel for which this membership key was created. This
* method will continue to return the channel even after the membership
* becomes {@link #isValid invalid}.
*返回创建多播成员关系key的通道,在多播成员关系key无效时,仍返回通道
* @return the channel
*/
public abstract MulticastChannel channel();
/**
* Returns the multicast group for which this membership key was created.
* This method will continue to return the group even after the membership
* becomes {@link #isValid invalid}.
*返回创建多播关系key的多播分组。在多播成员关系key无效时,仍返回分组地址信息
* @return the multicast group
*/
public abstract InetAddress group();
/**
* Returns the network interface for which this membership key was created.
* This method will continue to return the network interface even after the
* membership becomes {@link #isValid invalid}.
*返回创建多播成员关系key的网络接口信息。在多播成员关系key无效时,仍返回网络接口信息
* @return the network interface
*/
public abstract NetworkInterface networkInterface();
/**
* Returns the source address if this membership key is source-specific,
* or {@code null} if this membership is not source-specific.
*如果多播成员关系key的源地址是确定的则返回相应的源地址,否则返回null
* @return The source address if this membership key is source-specific,
* otherwise {@code null}
*/
public abstract InetAddress sourceAddress();
}
//NetworkInterface
package java.net;
import java.util.Enumeration;
import java.util.NoSuchElementException;
import sun.security.action.*;
import java.security.AccessController;
/**
* This class represents a Network Interface made up of a name,
* and a list of IP addresses assigned to this interface.
* It is used to identify the local interface on which a multicast group
* is joined.
*
* Interfaces are normally known by names such as "le0".
*
* @since 1.4
*/
public final class NetworkInterface {
private String name;
private String displayName;
private int index;
private InetAddress addrs[];
private InterfaceAddress bindings[];
private NetworkInterface childs[];
private NetworkInterface parent = null;
private boolean virtual = false;
private static final NetworkInterface defaultInterface;
private static final int defaultIndex; /* index of defaultInterface */
}
分享到:
相关推荐
Umi-OCR-main.zip
基于springboot+Web的毕业设计选题系统源码数据库文档.zip
基于springboot校外兼职教师考勤管理系统源码数据库文档.zip
58商铺全新UI试客试用平台网站源码
基于springboot大学生就业信息管理系统源码数据库文档.zip
基于SpringBoot的口腔诊所系统源码数据库文档.zip
数据存放网盘,txt文件内包含下载链接及提取码,永久有效。失效会第一时间进行补充。样例数据及详细介绍参见文章:https://blog.csdn.net/T0620514/article/details/143956923
3-240P2162218.zip
网络安全 基于Qt创建的Linux系统下的浏览器.zip
C++ 类和对象:多态-练习题目2(制作咖啡和茶叶)
基于springboot+J2EE在线项目管理与任务分配中的应用源码数据库文档.zip
简介本项目提供了一个在51单片机上运行的简单操作系统,旨在帮助学习者深入理解操作系统的基本原理和任务调度机制。该操作系统通过汇编和C语言编写,实现了任务调度、中断处理等核心功能,并提供了详细的源代码和注释,方便学习和实践。
本文将深度卷积神经网络(CNN)设计实现一个复杂结构的生成模型,旨在通过多阶段的编码器-解码器结构,能够有效地将灰度图像转换为彩色图像。最后,本文将实现一个简单的Web应用,用户可以通过上传灰度图像,应用会使用预训练的Caffe模型对其进行颜色化,并将结果返回给用户。 1.模型设计:模型由多个卷积层、ReLU激活函数和批归一化层组成,通过前向传播函数将输入的灰度图像(L通道)转换为彩色图像(ab通道)。如果指定了 pretrained=True,则会自动下载并加载预训练的模型权重。 2. 系统通过Flask框架提供了一个Web应用,用户可以上传灰度图像,系统会自动将其转换为彩色图像,并在网页上显示结果。整个过程包括文件验证、图像处理、颜色化预测和结果展示,具有较高的实用性和用户体验。
一个JAVA图形化的、联网的五子棋游戏.zip javaweb
KWDB 是一款面向 【AIoT 场景】的【分布式多模数据库】,支持在同一实例同时建立时序库和关系库并融合处理多模数据,具备千万级设备接入、百万级数据秒级写入、亿级数据秒级读取等时序数据高效处理能力,具有稳定安全、高可用、易运维等特点。
页面数量:7页 网页主题:网站模板、酒店网站模板、官方网站模板 网页页面:首页、关于我们、相关服务、服务详情、在线博客、博客详情、在线留言 页面实现元素:加载动画、滚动加载、主题切换、导航栏 、轮播图、图文列表、图片切换、 文字列表、 按钮悬停、图片悬停、表单 实现技术:HTML、CSS 、JQuery 源码样式及js文件均分开存放,所有内容仅供初学者学习参考
内容概要:本文档提供了详细的 Neo4j 安装与配置指南,涵盖 Windows、Linux 和 Mac 系统的安装步骤。具体包括下载、安装、启动服务、修改配置文件(如端口配置、远程访问和内存限制)、设置管理员密码以及基本的 Cypher 查询语言使用方法。同时,还提供了一些常见问题及其解决方案。 适合人群:数据库管理员、软件开发人员、系统管理员。 使用场景及目标:①帮助初学者快速掌握 Neo4j 的安装与配置;②适用于需要搭建和使用图数据库的项目;③为已有用户解决常见问题。 其他说明:本文档不仅包含了基础的安装和配置流程,还提供了实际操作中可能遇到的问题及其解决方法,有助于提高使用者的实际操作能力。
基于SpringBoot+Vue的软件产品展示销售系统源码数据库文档.zip
《书戴嵩画牛》教学课件.pptx
20届智能车 【项目资源】:包含前端、后端、移动开发、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源,毕业设计等各种技术项目的源码。包括C++、Java、python、web、C#、EDA等项目的源码。 【适用人群】:适用于希望学习不同技术领域的初学者或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。 【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。 【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。