⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jxtamulticastsocket.html

📁 jxta的api库
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><TITLE>JxtaMulticastSocket (Project JXTA J2SE)</TITLE><META NAME="keywords" CONTENT="net.jxta.socket.JxtaMulticastSocket class"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){    parent.document.title="JxtaMulticastSocket (Project JXTA J2SE)";}</SCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/JxtaMulticastSocket.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><a href='http://www.jxta.org' target='_blank'>Project JXTA</a></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;PREV CLASS&nbsp;&nbsp;<A HREF="../../../net/jxta/socket/JxtaServerSocket.html" title="class in net.jxta.socket"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="JxtaMulticastSocket.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<SCRIPT type="text/javascript">  <!--  if(window==top) {    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');  }  //--></SCRIPT><NOSCRIPT>  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">net.jxta.socket</FONT><BR>Class JxtaMulticastSocket</H2><PRE>java.lang.Object  <IMG SRC="../../../resources/inherit.gif" ALT="extended by">java.net.DatagramSocket      <IMG SRC="../../../resources/inherit.gif" ALT="extended by">java.net.MulticastSocket          <IMG SRC="../../../resources/inherit.gif" ALT="extended by"><B>net.jxta.socket.JxtaMulticastSocket</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD>java.util.EventListener, <A HREF="../../../net/jxta/pipe/PipeMsgListener.html" title="interface in net.jxta.pipe">PipeMsgListener</A></DD></DL><HR><DL><DT>public class <B>JxtaMulticastSocket</B><DT>extends java.net.MulticastSocket<DT>implements <A HREF="../../../net/jxta/pipe/PipeMsgListener.html" title="interface in net.jxta.pipe">PipeMsgListener</A></DL><P>The JxtaMulticastSocket class is useful for sending and receiving  JXTA multicast packets. A JxtaMulticastSocket is a (UDP) DatagramSocket,  with additional capabilities for joining "groups" of other multicast hosts on the internet. A multicast group is specified within the context of PeerGroup and a propagate pipe advertisement.  One would join a multicast group by first creating a MulticastSocket with the desired peer group and pipe advertisment :  // join a Multicast group and send the group salutations  ...  String msg = "Hello";  InetAddress group = InetAddress.getByName("228.5.6.7");  MulticastSocket s = new JxtaMulticastSocket(peergroup, propPipeAdv);  //We are joined at this point  DatagramPacket hi = new DatagramPacket(msg.getBytes(), msg.length()); s.send(hi);  // get their responses!  byte[] buf = new byte[1000];  DatagramPacket recv = new DatagramPacket(buf, buf.length);  s.receive(recv);  ...  // OK, I'm done talking - leave the group...  s.close();   One can also respond only to the sender of the datagram as follows  DatagramPacket res = new DatagramPacket(response.getBytes(), response.length());  res.setAddress(recv.getAddress());  s.send(res); When one sends a message to a multicast group, all subscribing recipients to that peergroup and pipe receive the message (including themselves) When a socket subscribes to a multicast group/port, it receives datagrams  sent by other hosts to the group/pipe, as do all other members of the group and pipe. A socket relinquishes membership in a group by the  close() method. Multiple MulticastSocket's may  subscribe to a multicast group and pipe concurrently, and they will all receive group datagrams. When a datagram is sent it carries along with the peerid of the sender. The PeerID is represented as a InetAddress in the form of host/ipadress where host name is the peerid, and ip address is always represented as 0.0.0.0 since it is meaningless in the context of JXTA. e.g of InetAddress resembles the following: uuid-59616261646162614A787461503250339C6014B0F21A49DBBDF2ADBDDBCB314703/0.0.0.0<P><P><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#bound">bound</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#closed">closed</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;<A HREF="../../../net/jxta/credential/Credential.html" title="interface in net.jxta.credential">Credential</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#credential">credential</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;<A HREF="../../../net/jxta/document/StructuredDocument.html" title="interface in net.jxta.document">StructuredDocument</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#credentialDoc">credentialDoc</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#DATATAG">DATATAG</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;<A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#group">group</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;<A HREF="../../../net/jxta/pipe/InputPipe.html" title="interface in net.jxta.pipe">InputPipe</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#in">in</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;java.net.InetAddress</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#localAddress">localAddress</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#NAMESPACE">NAMESPACE</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;<A HREF="../../../net/jxta/pipe/OutputPipe.html" title="interface in net.jxta.pipe">OutputPipe</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#outputPipe">outputPipe</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;<A HREF="../../../net/jxta/protocol/PipeAdvertisement.html" title="class in net.jxta.protocol">PipeAdvertisement</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#pipeAdv">pipeAdv</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;<A HREF="../../../net/jxta/pipe/PipeService.html" title="interface in net.jxta.pipe">PipeService</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#pipeSvc">pipeSvc</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;<A HREF="../../../net/jxta/impl/util/ProducerBiasedQueue.html" title="class in net.jxta.impl.util">ProducerBiasedQueue</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#queue">queue</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected &nbsp;java.net.SocketAddress</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#socketAddress">socketAddress</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;java.lang.String</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#SRCIDTAG">SRCIDTAG</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD></TR></TABLE>&nbsp;<A NAME="fields_inherited_from_class_java.net.DatagramSocket"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from class java.net.DatagramSocket</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE></CODE></TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../net/jxta/socket/JxtaMulticastSocket.html#JxtaMulticastSocket(net.jxta.peergroup.PeerGroup, net.jxta.protocol.PipeAdvertisement)">JxtaMulticastSocket</A></B>(<A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A>&nbsp;group,                    <A HREF="../../../net/jxta/protocol/PipeAdvertisement.html" title="class in net.jxta.protocol">PipeAdvertisement</A>&nbsp;pipeAd)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a multicast socket and bind it to a specific pipe within specified  peer group</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -