📄 messageconnection.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Tue Apr 23 16:45:51 EEST 2002 -->
<TITLE>
MessageConnection (Nokia SMS API)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<SCRIPT>
function asd()
{
parent.document.title="MessageConnection (Nokia SMS API)";
}
</SCRIPT>
<BODY BGCOLOR="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<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>
<a href=http://forum.nokia.com/java target=_top><img src=../../../../doc-files/forum_logo.gif border=0></a></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../com/nokia/mid/messaging/Message.html"><B>PREV CLASS</B></A>
<A HREF="../../../../com/nokia/mid/messaging/MessageListener.html"><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="MessageConnection.html" TARGET="_top"><B>NO FRAMES</B></A>
<SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT><A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.nokia.mid.messaging</FONT>
<BR>
Interface MessageConnection</H2>
<DL>
<DT><B>All Superinterfaces:</B> <DD>javax.microedition.io.Connection</DD>
</DL>
<HR>
<DL>
<DT>public interface <B>MessageConnection</B><DT>extends javax.microedition.io.Connection</DL>
<P>
<p>The MessageConnection interface defines the basic functionality for sending and receiving message. </p> <p>'Client' mode connections (i.e. for only sending messages) are created by passing a string identifying a destination address to the Connector.open() method. </p> <p>'Server' mode connections (i.e. for receiving and sending messages) are created by passing a string that identifies a port, or equivalent, on the local host to the Connector.open() method. If the requested port number is already reserved, either by some system application or by another MIDlet, the Connector.open() method shall throw an IOException. MIDlets shall be able to open MessageConnections for any unreserved port number, although security permissions may not allow it to send or receive messages using that port number. </p> <p>The 'scheme' that identifies the used protocol is specific to the given protocol. This interface does not assume any specific protocol but is intended for all wireless messaging protocols. </p>
<P>
<P>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<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>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/nokia/mid/messaging/MessageConnection.html#BINARY_MESSAGE">BINARY_MESSAGE</A></B></CODE>
<BR>
Constant for a message type for binary messages (value = 2). </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/nokia/mid/messaging/MessageConnection.html#TEXT_MESSAGE">TEXT_MESSAGE</A></B></CODE>
<BR>
Constant for a message type for text messages (value = 1). </TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<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="../../../../com/nokia/mid/messaging/Message.html">Message</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/nokia/mid/messaging/MessageConnection.html#newMessage(int)">newMessage</A></B>(int type)</CODE>
<BR>
Constructs a new message object of a given type. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../com/nokia/mid/messaging/Message.html">Message</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/nokia/mid/messaging/MessageConnection.html#newMessage(int, java.lang.String)">newMessage</A></B>(int type, java.lang.String address)</CODE>
<BR>
Constructs a new message object of a given type and initializes it with the given destination address. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/nokia/mid/messaging/MessageConnection.html#numberOfMessages(com.nokia.mid.messaging.Message)">numberOfMessages</A></B>(<A HREF="../../../../com/nokia/mid/messaging/Message.html">Message</A> msg)</CODE>
<BR>
Returns how many SMS messages will be needed for sending the Message given as the parameter. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../com/nokia/mid/messaging/Message.html">Message</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/nokia/mid/messaging/MessageConnection.html#receive()">receive</A></B>()</CODE>
<BR>
Receives a message If there are no Messages for this Connection waiting, this message will block until a message for this Connection is received, or the Connection is closed. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/nokia/mid/messaging/MessageConnection.html#registerMessageListener(com.nokia.mid.messaging.MessageListener)">registerMessageListener</A></B>(<A HREF="../../../../com/nokia/mid/messaging/MessageListener.html">MessageListener</A> l)</CODE>
<BR>
Registers a MessageListener object. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/nokia/mid/messaging/MessageConnection.html#send(com.nokia.mid.messaging.Message)">send</A></B>(<A HREF="../../../../com/nokia/mid/messaging/Message.html">Message</A> msg)</CODE>
<BR>
Sends the message </TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_javax.microedition.io.Connection"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from interface javax.microedition.io.Connection</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>close</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="TEXT_MESSAGE"><!-- --></A><H3>
TEXT_MESSAGE</H3>
<PRE>
public static final int <B>TEXT_MESSAGE</B></PRE>
<DL>
<DD>Constant for a message type for text messages (value = 1). Using this constant as the type parameter in the newMessage() methods shall cause the newly created Message to be an instance implementing the TextMessage interface.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#com.nokia.mid.messaging.MessageConnection.TEXT_MESSAGE">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="BINARY_MESSAGE"><!-- --></A><H3>
BINARY_MESSAGE</H3>
<PRE>
public static final int <B>BINARY_MESSAGE</B></PRE>
<DL>
<DD>Constant for a message type for binary messages (value = 2). Using this constant as the type parameter in the newMessage() methods shall cause the newly created Message to be an instance implementing the BinaryMessage interface.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#com.nokia.mid.messaging.MessageConnection.BINARY_MESSAGE">Constant Field Values</A></DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -