<!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_03) on Mon Oct 10 16:31:47 CEST 2005 -->
<TITLE>
DatagramConnection (IM Profile)
</TITLE>

<META NAME="keywords" CONTENT="javax.microedition.io.DatagramConnection interface">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="DatagramConnection (IM Profile)";
}
</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/DatagramConnection.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>
<strong>IM Profile</strong></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../javax/microedition/io/HttpConnection.html" title="interface in javax.microedition.io"><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="DatagramConnection.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;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&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">
javax.microedition.io</FONT>
<BR>
Interface DatagramConnection</H2>
<DL>
<DT><B>All Superinterfaces:</B> <DD><A HREF="../../../javax/microedition/io/Connection.html" title="interface in javax.microedition.io">Connection</A></DD>
</DL>
<DL>
<DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../javax/microedition/io/UDPDatagramConnection.html" title="interface in javax.microedition.io">UDPDatagramConnection</A></DD>
</DL>
<HR>
<DL>
<DT>public interface <B>DatagramConnection</B><DT>extends <A HREF="../../../javax/microedition/io/Connection.html" title="interface in javax.microedition.io">Connection</A></DL>

<P>
This interface defines the capabilities that a datagram connection
 must have.
 <p>
 Reminder: Since the CLDC Specification does not define any
 actual network protocol implementations, the syntax for 
 datagram addressing is not defined in the CLDC Specification.
 Rather, syntax definition takes place at the level of J2ME
 profiles such as MIDP.
 <p>
 In the sample implementation that is provided as part of the
 CLDC reference implementation, the following addressing scheme
 is used:
 <p>
 The parameter string describing the target of a connection
 in the CLDC reference implementation takes the following form:

 <pre>
 {protocol}://[{host}]:[{port}]
 </pre>

 A datagram connection can be opened in a "client" mode or "server" mode.
 If the "//{host}" part is missing then the connection  is opened as 
 a "server" (by "server", we mean that a client application initiates
 communication). When the "//{host}" part is specified, the connection
 is opened as a "client".
 <p>
 Examples:
 <p>
  A datagram connection for accepting datagrams<br>
  datagram://:1234<p>
  A datagram connection for sending to a server:<br>
  datagram://123.456.789.12:1234<p>

 Note that the port number in "server mode" (unspecified host name) is 
 that of the receiving port. The port number in "client mode" (host name
 specified) is that of the target port. The reply-to port in both cases
 is never unspecified. In "server mode", the same port number is used for 
 both receiving and sending. In "client mode", the reply-to port is 
 always dynamically allocated.
 <p>
 Also note that the allocation of datagram objects is done in a
 more abstract way than in Java 2 Standard Edition (J2SE).
 Instead of providing a concrete <code>DatagramPacket</code> class, 
 an abstract <code>Datagram</code> interface is provided.  This
 is to allow a single platform to support several different datagram  
 interfaces simultaneously.  Datagram objects must be allocated by 
 calling the <code>newDatagram</code> methods of the 
 <code>DatagramConnection</code> object. 
 The resulting object is defined using another interface type 
 called <code>javax.microedition.io.Datagram</code>.
<P>

<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>CLDC 1.0</DD>
</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>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/DatagramConnection.html#getMaximumLength()">getMaximumLength</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the maximum length a datagram can be.
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/DatagramConnection.html#getNominalLength()">getNominalLength</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the nominal length of a datagram.
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/DatagramConnection.html#newDatagram(byte[], int)">newDatagram</A></B>(byte[]&nbsp;buf,
            int&nbsp;size)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a new datagram object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/DatagramConnection.html#newDatagram(byte[], int, java.lang.String)">newDatagram</A></B>(byte[]&nbsp;buf,
            int&nbsp;size,
            <A HREF="../../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;addr)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Make a new datagram object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/DatagramConnection.html#newDatagram(int)">newDatagram</A></B>(int&nbsp;size)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a new datagram object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/DatagramConnection.html#newDatagram(int, java.lang.String)">newDatagram</A></B>(int&nbsp;size,
            <A HREF="../../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;addr)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a new datagram object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/DatagramConnection.html#receive(javax.microedition.io.Datagram)">receive</A></B>(<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A>&nbsp;dgram)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Receive a datagram.  </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/DatagramConnection.html#send(javax.microedition.io.Datagram)">send</A></B>(<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A>&nbsp;dgram)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Send a datagram.  </TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_javax.microedition.io.Connection"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from interface javax.microedition.io.<A HREF="../../../javax/microedition/io/Connection.html" title="interface in javax.microedition.io">Connection</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../javax/microedition/io/Connection.html#close()">close</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= CONSTRUCTOR DETAIL ======== -->


<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="getMaximumLength()"><!-- --></A><H3>
getMaximumLength</H3>
<PRE>
public int <B>getMaximumLength</B>()
                     throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Get the maximum length a datagram can be.
 Maximum length determines the maximum size
 of the datagram that can be created using 
 the <code>newDatagram</code> method, and the 
 maximum size of the datagram that can be sent
 or received.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>The maximum length of a datagram.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - If an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="getNominalLength()"><!-- --></A><H3>
getNominalLength</H3>
<PRE>
public int <B>getNominalLength</B>()
                     throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Get the nominal length of a datagram.
 Nominal length refers to the size of the 
 datagram that is stored into the data buffer.
 Nominal length may be equal or
 less than the maximum length of the datagram.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>The nominal length of a datagram.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - If an I/O error occurs.</DL>
</DD>
</DL>
<HR>

<A NAME="send(javax.microedition.io.Datagram)"><!-- --></A><H3>
send</H3>
<PRE>
public void <B>send</B>(<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A>&nbsp;dgram)
          throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Send a datagram.  The <code>Datagram</code> object includes
 the information indicating the data to be sent, its length,
 and the address of the receiver.  The method sends <code>length</code>
 bytes starting at the current <code>offset</code> of the
 <code>Datagram</code> object, where <code>length</code>
 and <code>offset</code> are internal state variables 
 of the <code>Datagram</code> object.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dgram</CODE> - A datagram.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - If an I/O error occurs.
<DD><CODE><A HREF="../../../java/io/InterruptedIOException.html" title="class in java.io">InterruptedIOException</A></CODE> - Timeout or interrupt occurred.</DL>
</DD>
</DL>
<HR>

<A NAME="receive(javax.microedition.io.Datagram)"><!-- --></A><H3>
receive</H3>
<PRE>
public void <B>receive</B>(<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A>&nbsp;dgram)
             throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Receive a datagram.  When this method returns, the internal
 buffer in the <code>Datagram</code> object is filled with
 the data received, starting at the location determined by
 the <code>offset</code> state variable, and the data is
 ready to be read using the methods of the 
 <code>DataInput</code> interface.
 <p>
 This method blocks until a datagram is received.  The internal
 <code>length</code> state variable in the <code>Datagram</code>
 object contains the length of the received datagram.  If the
 received data is longer than the length of the internal buffer
 minus offset, data is truncated.
 <p>
 This method does not change the internal <i>read/write<i> state
 variable of the <code>Datagram</code> object. Use method 
 <code>Datagram.reset</code> to change the pointer before
 reading if necessary.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>dgram</CODE> - A datagram.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - If an I/O error occurs.
<DD><CODE><A HREF="../../../java/io/InterruptedIOException.html" title="class in java.io">InterruptedIOException</A></CODE> - Timeout or interrupt occurred.</DL>
</DD>
</DL>
<HR>

<A NAME="newDatagram(int)"><!-- --></A><H3>
newDatagram</H3>
<PRE>
public <A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A> <B>newDatagram</B>(int&nbsp;size)
                     throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Create a new datagram object.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>size</CODE> - The size of the buffer needed 
                         for the datagram
<DT><B>Returns:</B><DD>A new datagram
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - If an I/O error occurs.
<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the size is negative
                         or larger than the maximum size</DL>
</DD>
</DL>
<HR>

<A NAME="newDatagram(int, java.lang.String)"><!-- --></A><H3>
newDatagram</H3>
<PRE>
public <A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A> <B>newDatagram</B>(int&nbsp;size,
                            <A HREF="../../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;addr)
                     throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Create a new datagram object.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>size</CODE> - The size of the buffer needed
                         for the datagram<DD><CODE>addr</CODE> - The I/O address to which the datagram
                         will be sent
<DT><B>Returns:</B><DD>A new datagram
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - If an I/O error occurs.
<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the size is negative or
                         larger than the maximum size, or if the
                         address parameter is invalid</DL>
</DD>
</DL>
<HR>

<A NAME="newDatagram(byte[], int)"><!-- --></A><H3>
newDatagram</H3>
<PRE>
public <A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A> <B>newDatagram</B>(byte[]&nbsp;buf,
                            int&nbsp;size)
                     throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Create a new datagram object.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - The buffer to be used for the datagram<DD><CODE>size</CODE> - The size of the buffer needed
                         for the datagram
<DT><B>Returns:</B><DD>A new datagram
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - If an I/O error occurs.
<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the size is negative or
                         larger than the maximum size or the given
                         buffer's length, or if the buffer parameter 
                         is invalid</DL>
</DD>
</DL>
<HR>

<A NAME="newDatagram(byte[], int, java.lang.String)"><!-- --></A><H3>
newDatagram</H3>
<PRE>
public <A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io">Datagram</A> <B>newDatagram</B>(byte[]&nbsp;buf,
                            int&nbsp;size,
                            <A HREF="../../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;addr)
                     throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Make a new datagram object.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>buf</CODE> - The buffer to be used for the datagram<DD><CODE>size</CODE> - The size of the buffer needed
                         for the datagram<DD><CODE>addr</CODE> - The I/O address to which the datagram
                         will be sent
<DT><B>Returns:</B><DD>A new datagram
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - If an I/O error occurs.
<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the size is negative or
                         larger than the maximum size or the given
                         buffer's length, or if the address or 
                         buffer parameter is invalid</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>


<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" 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_bottom_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/DatagramConnection.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>
<strong>IM Profile</strong></EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../javax/microedition/io/Datagram.html" title="interface in javax.microedition.io"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../javax/microedition/io/HttpConnection.html" title="interface in javax.microedition.io"><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="DatagramConnection.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;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
<font size=\-1\><a href=\mailto:midp-feedback@risc.sps.mot.com\>Submit a comment or suggestion</a> Version 2.0 of IM Profile Specification<br>Java is a trademark or registered trademark of Sun Microsystems,  Inc. in the US and other countries. Copyright (c) 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road,Palo Alto, California, 94303, U.S.A.  All Rights Reserved.</font>
</BODY>
</HTML>
