📄 sipconnectionnotifier.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_10) on Wed Feb 28 12:31:09 CET 2007 -->
<TITLE>
SipConnectionNotifier (JSR180 SIP API for J2ME)
</TITLE>
<META NAME="keywords" CONTENT="javax.microedition.sip.SipConnectionNotifier interface">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="SipConnectionNotifier (JSR180 SIP API for J2ME)";
}
</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> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../javax/microedition/sip/SipConnection.html" title="interface in javax.microedition.sip"><B>PREV CLASS</B></A>
<A HREF="../../../javax/microedition/sip/SipDialog.html" title="interface in javax.microedition.sip"><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>
<A HREF="SipConnectionNotifier.html" target="_top"><B>NO FRAMES</B></A>
<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: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | CONSTR | <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">
javax.microedition.sip</FONT>
<BR>
Interface SipConnectionNotifier</H2>
<DL>
<DT><B>All Superinterfaces:</B> <DD>javax.microedition.io.Connection</DD>
</DL>
<HR>
<DL>
<DT>public interface <B>SipConnectionNotifier</B><DT>extends javax.microedition.io.Connection</DL>
<P>
This interface defines a SIP server connection notifier. The SIP server connection is opened with <tt>Connector.open()</tt>using a SIP URI string with the host and user omitted. For the detailed specification of SIP server URIs see the section: <A HREF="./SipConnection.html#SERVERURI"><code>"SipConnection: Opening new server connection"</code></A>. <p> For example, URI <tt>sip:5060</tt> defines an inbound SIP server connection on port 5060. The local address can be discovered using the <tt>getLocalAddress()</tt> method. If the port number is already reserved the <tt>Connector.open()</tt> MUST throw <tt>IOException</tt>. <p> <tt>SipConnectionNotifier</tt> can be also opened with <tt>sips:</tt> protocol scheme, which indicates that this server connection accepts only requests over secure transport (as defined in RFC 3261 [1] for SIPS URIs). <p> <tt>SipConnectionNotifier</tt> is queueing received messages. In order to receive incoming requests application calls the <tt>acceptAndOpen()</tt> method, which returns a <tt>SipServerConnection</tt> instance. If there are no messages in the queue <tt>acceptAndOpen()</tt> will block until a new request is received. <tt>SipServerConnection</tt> holds the incoming SIP request message. <tt>SipServerConnection</tt> is used to initialize and send responses. <p> Access to SIP server connections may be restricted by the security policy of the device. <tt>Connector.open MUST</tt> check access for the initial SIP server connection and <tt>acceptAndOpen()</tt> MUST check before returning each new <tt>SipServerConnection</tt>. <p> A SIP server connection can be used to dynamically select an available port by omitting both the host and the port parameters in the connection SIP URI string. The string <tt>sip:</tt> defines an inbound SIP server connection on a port which is allocated by the system. To discover the assigned port number use the <tt>getLocalPort()</tt> method. <p> The <tt>SipConnectionNotifier</tt> offers also an asynchronous callback interface to wait for incoming requests. The interface is defined in <tt>SipServerConnectionListener</tt> , which the user has to implement in order to receive notifications about incoming requests. <p> Here is an example method, which opens an inbound SIP server connection: <p> <pre> public SipServerConnection openSipServerConnection() { SipConnectionNotifier scn = null; SipServerConnection ssc = null; try { // let the system select the port scn = (SipConnectionNotifier) Connector.open("sip:"); ssc = scn.acceptAndOpen(); return(ssc); } catch(Exception ex) { // handle IOException, InterruptedIOException, SecurityException // or SipException } } </pre> Here is another example class, which uses the callback listener interface: <pre> public class SipServer implements SipServerConnectionListener { SipServer(String uri) { try { // user selects the port scn = (SipConnectionNotifier) Connector.open("sip:5080"); scn.setListener(this); } catch(Exception ex) { // handle Exceptions } } public void notifyRequest(SipConnectionNotifier scn) { SipServerConnection ssc = scn.acceptAndOpen(); String method = ssc.getMethod(); // continue with the incoming request etc... } } </pre>
<P>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/sip/SipConnection.html" title="interface in javax.microedition.sip"><CODE>SipConnection</CODE></A>, <A HREF="../../../javax/microedition/sip/SipServerConnection.html" title="interface in javax.microedition.sip"><CODE>SipServerConnection</CODE></A>, <A HREF="../../../javax/microedition/sip/SipClientConnection.html" title="interface in javax.microedition.sip"><CODE>SipClientConnection</CODE></A>, <A HREF="../../../javax/microedition/sip/SipServerConnectionListener.html" title="interface in javax.microedition.sip"><CODE>SipServerConnectionListener</CODE></A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../javax/microedition/sip/SipServerConnection.html" title="interface in javax.microedition.sip">SipServerConnection</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipConnectionNotifier.html#acceptAndOpen()">acceptAndOpen</A></B>()</CODE>
<BR>
Accepts and opens a new <tt>SipServerConnection</tt> in this
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -