<!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>
SocketConnection (IM Profile)
</TITLE>

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

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

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="SocketConnection (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/SocketConnection.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/ServerSocketConnection.html" title="interface in javax.microedition.io"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../javax/microedition/io/StreamConnection.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="SocketConnection.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;CONSTR&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;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 SocketConnection</H2>
<DL>
<DT><B>All Superinterfaces:</B> <DD><A HREF="../../../javax/microedition/io/Connection.html" title="interface in javax.microedition.io">Connection</A>, <A HREF="../../../javax/microedition/io/InputConnection.html" title="interface in javax.microedition.io">InputConnection</A>, <A HREF="../../../javax/microedition/io/OutputConnection.html" title="interface in javax.microedition.io">OutputConnection</A>, <A HREF="../../../javax/microedition/io/StreamConnection.html" title="interface in javax.microedition.io">StreamConnection</A></DD>
</DL>
<DL>
<DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../javax/microedition/io/SecureConnection.html" title="interface in javax.microedition.io">SecureConnection</A></DD>
</DL>
<HR>
<DL>
<DT>public interface <B>SocketConnection</B><DT>extends <A HREF="../../../javax/microedition/io/StreamConnection.html" title="interface in javax.microedition.io">StreamConnection</A></DL>

<P>
This interface defines the socket stream connection.
 <P>
 A socket is accessed using a generic connection string with an explicit host 
 and port number. The host may be specified as a fully qualified host name or 
 IPv4 number.
 e.g. <code>socket://host.com:79</code> defines a target socket on the 
 <code>host.com</code> system at 
 port <code>79</code>.
 <P>Note that 
 RFC1900 recommends the use of names rather than IP numbers for best results
 in the event of IP number reassignment. </P>
 <H3> Closing Streams </H3>
 <P>
 Every <code>StreamConnection</code> provides a <code>Connection</code>
 object as well as an <code>InputStream</code> and <code>OutputStream</code>
 to handle the I/O associated with the connection. Each of these interfaces
 has its own <code>close()</code> method. For systems that support
 duplex communication over the socket connection, closing of the 
 input or output stream SHOULD shutdown just that side of the 
 connection. e.g. closing the <code>InputStream</code> will permit the
 <code>OutputStream</code> to continue sending data.
 </P>
 <P>
 Once the input or output stream has been closed, it can only be reopened
 with a call to <code>Connector.open()</code>. The application will receive
 an <code>IOException</code> if an attempt is made to reopen the stream.
 </P>
 <H2>
 BNF Format for Connector.open() string
 </H2>
 <P>
 The URI must conform to the BNF syntax specified below.  If the URI
 does not conform to this syntax, an <code>IllegalArgumentException</code>
 is thrown.
 </P>
 <TABLE BORDER="1">
 <TR>
 <TD>&lt;socket_connection_string&gt; </TD>
 <TD>::= "<strong>socket://</strong>"&lt;hostport&gt; </TD>
 </TR>
 <TR>
 <TD>&lt;hostport&gt; </TD>
 <TD>::= <I>host</I> ":" <I>port </I> </TD>
 </TR>
 <TR>
 <TD>&lt;host&gt; </TD>
 <TD>::= <I>host name or IP address </I> (omitted for inbound connections,
 See <a href="ServerSocketConnection.html">ServerSocketConnection</a>)
 </TD>
 </TR>
 <TR>
 <TD>&lt;port&gt; </TD>
 <TD>::= <I>numeric port number </I> </TD>
 </TR>
 </TABLE>

 </P>
 Optional parameters are:
 </P>
 <TABLE BORDER="1">

 <TR>
 <TD>&lt;bearer_type&gt; </TD>
 <TD>::= ";bearer_type="&lt;bearer_type_value&gt </TD>
 </TR>
 <TR>
 <TD>&lt;bearer_type_value&gt </TD>
 <TD>::= "GPRS" | "CSD" ; </TD>
 </TR>

 <TR>
 <TD>&lt;access_point&gt</TD>
 <TD>::= ";access_point="&lt;access_point_value&gt </TD>
 </TR>
 <TR>
 <TD>&lt;access_point_value&gt </TD>
 <TD>::= &lt;string&gt </TD>
 </TR>

 <TR>
 <TD>&lt;username&gt </TD>
 <TD>::= ";username="&lt;username_value&gt </TD>
 </TR>
 <TR>
 <TD>&lt;username_value&gt </TD>
 <TD>::= 1*&lt;characters allowed in user names&gt </TD>
 </TR> 

 <TR>
 <TD>&lt;password&gt </TD>
 <TD>::= ";password="&lt;password_value&gt </TD>
 </TR>
 <TR>
 <TD>&lt;password_value&gt </TD>
 <TD>::= 1*&lt;characters allowed in passwords&gt </TD>
 </TR> 

 <TR>
 <TD>&lt;dns&gt; </TD>
 <TD>::= ";dns="&lt;dns_value&gt; </TD>
 </TR>
 <TR>
 <TD>&lt;dns_value&gt; </TD>
 <TD>::= &lt;number&gt.&lt;number&gt.&lt;number&gt.&lt;number&gt; </TD>
 </TR> 

 <TR>
 <TD>&lt;phone_number&gt; </TD>
 <TD>::= ";phone_number="&lt;phone_number_value&gt; </TD>
 </TR>
 <TR>
 <TD>&lt;phone_number_value&gt; </TD>
 <TD>::= &lt;phone_number_digits&gt; </TD>
 </TR> 

 <TR>
 <TD>&lt;timeout&gt; </TD>
 <TD>::= ";timeout="&lt;timeout_value&gt; </TD>
 </TR>
 <TR>
 <TD>&lt;timeout_value&gt; </TD>
 <TD>::= &lt;int&gt | null; </TD>
 </TR> 

 </TABLE>

 </P>
 [<i>Siemens WM</i>]<br>
 In TC65 the optional parameters are an alternative interface to at^sjnet, so the same rules apply.<br>
 The TC65 does not support the socket options KEEPALIVE and LINGER.
 

 <H3>
 Examples
 </H3>
 <P>
 The following examples show how a <code>SocketConnection</code>
 would be used to access a sample loopback program.
 </P>
 <PRE>
   SocketConnection sc = (SocketConnection)
                         Connector.open("socket://host.com:79");
   sc.setSocketOption(SocketConnection.LINGER, 5);

   InputStream is  = sc.openInputStream();
   OutputStream os = sc.openOutputStream();

   os.write("\r\n".getBytes());
   int ch = 0;
   while(ch != -1) {
       ch = is.read();
   }

   is.close();
   os.close();
   sc.close();
 </PRE>

 When using the optional parameters the socket could be opend like:
 </P>
 <PRE>
   SocketConnection sc = (SocketConnection)
     Connector.open("socket://host.com:79;bearer_type=gprs;access_point=internet.provi.de;dns=198.168.0.10;username=someone;password=something;timeout=40);
 </PRE>
<P>

<P>
<DL>
<DT><B>Since:</B></DT>
  <DD>MIDP 2.0</DD>
</DL>
<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>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/SocketConnection.html#DELAY">DELAY</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Socket option for the small buffer <em>writing delay</em> (0).
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/SocketConnection.html#KEEPALIVE">KEEPALIVE</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Socket option for the <em>keep alive</em> feature (2).
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/SocketConnection.html#LINGER">LINGER</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Socket option for the <em>linger time</em> to wait in seconds
 before closing a connection with
 pending data output (1). </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/SocketConnection.html#RCVBUF">RCVBUF</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Socket option for the size of the <em>receiving buffer</em> (3).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/SocketConnection.html#SNDBUF">SNDBUF</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Socket option for the size of the <em>sending buffer</em> (4).</TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== 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;<A HREF="../../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/SocketConnection.html#getAddress()">getAddress</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the remote address to which the socket is bound.
 </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/io/SocketConnection.html#getLocalAddress()">getLocalAddress</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the local address to which the socket is bound.

 </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/SocketConnection.html#getLocalPort()">getLocalPort</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the local port to which this socket is bound.</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/SocketConnection.html#getPort()">getPort</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the remote port to which this socket is bound.</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/SocketConnection.html#getSocketOption(byte)">getSocketOption</A></B>(byte&nbsp;option)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get a socket option for the connection.</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/SocketConnection.html#setSocketOption(byte, int)">setSocketOption</A></B>(byte&nbsp;option,
                int&nbsp;value)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set a socket option for the connection.
 </TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_javax.microedition.io.InputConnection"><!-- --></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/InputConnection.html" title="interface in javax.microedition.io">InputConnection</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../javax/microedition/io/InputConnection.html#openDataInputStream()">openDataInputStream</A>, <A HREF="../../../javax/microedition/io/InputConnection.html#openInputStream()">openInputStream</A></CODE></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;<A NAME="methods_inherited_from_class_javax.microedition.io.OutputConnection"><!-- --></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/OutputConnection.html" title="interface in javax.microedition.io">OutputConnection</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../javax/microedition/io/OutputConnection.html#openDataOutputStream()">openDataOutputStream</A>, <A HREF="../../../javax/microedition/io/OutputConnection.html#openOutputStream()">openOutputStream</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

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

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

<A NAME="DELAY"><!-- --></A><H3>
DELAY</H3>
<PRE>
public static final byte <B>DELAY</B></PRE>
<DL>
<DD>Socket option for the small buffer <em>writing delay</em> (0).
 Set to zero to disable Nagle algorithm for 
 small buffer operations.
 Set to a non-zero value to enable.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.microedition.io.SocketConnection.DELAY">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="LINGER"><!-- --></A><H3>
LINGER</H3>
<PRE>
public static final byte <B>LINGER</B></PRE>
<DL>
<DD>Socket option for the <em>linger time</em> to wait in seconds
 before closing a connection with
 pending data output (1). Setting the linger time to zero
 disables the linger wait interval.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.microedition.io.SocketConnection.LINGER">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="KEEPALIVE"><!-- --></A><H3>
KEEPALIVE</H3>
<PRE>
public static final byte <B>KEEPALIVE</B></PRE>
<DL>
<DD>Socket option for the <em>keep alive</em> feature (2).
 Setting KEEPALIVE to zero will disable the feature.
 Setting KEEPALIVE to a non-zero value will enable the feature.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.microedition.io.SocketConnection.KEEPALIVE">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="RCVBUF"><!-- --></A><H3>
RCVBUF</H3>
<PRE>
public static final byte <B>RCVBUF</B></PRE>
<DL>
<DD>Socket option for the size of the <em>receiving buffer</em> (3).
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.microedition.io.SocketConnection.RCVBUF">Constant Field Values</A></DL>
</DL>
<HR>

<A NAME="SNDBUF"><!-- --></A><H3>
SNDBUF</H3>
<PRE>
public static final byte <B>SNDBUF</B></PRE>
<DL>
<DD>Socket option for the size of the <em>sending buffer</em> (4).
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#javax.microedition.io.SocketConnection.SNDBUF">Constant Field Values</A></DL>
</DL>

<!-- ========= 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="setSocketOption(byte, int)"><!-- --></A><H3>
setSocketOption</H3>
<PRE>
public void <B>setSocketOption</B>(byte&nbsp;option,
                            int&nbsp;value)
                     throws <A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A>,
                            <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Set a socket option for the connection.
 <P>
 Options inform the low level networking code about intended
 usage patterns that the application will use in dealing with
 the socket connection.
 </P>
 <P>
 Calling <code>setSocketOption</code> to assign buffer sizes
 is a hint to the platform of the sizes to set the underlying 
 network I/O buffers.
 Calling <code>getSocketOption</code> can  be used to see what 
 sizes the system is using.
 The system MAY adjust the buffer sizes to account for 
 better throughput available from Maximum Transmission Unit
 (MTU) and Maximum Segment Size (MSS) data available 
 from current network information.
 </P>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>option</CODE> - socket option identifier (KEEPALIVE, LINGER,
 SNDBUF, RCVBUF, or DELAY)<DD><CODE>value</CODE> - numeric value for specified option
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if  the value is not
              valid (e.g. negative value) or if the option
              identifier is not valid
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if the connection was closed<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/SocketConnection.html#getSocketOption(byte)"><CODE>getSocketOption(byte)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getSocketOption(byte)"><!-- --></A><H3>
getSocketOption</H3>
<PRE>
public int <B>getSocketOption</B>(byte&nbsp;option)
                    throws <A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A>,
                           <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Get a socket option for the connection.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>option</CODE> - socket option identifier (KEEPALIVE, LINGER,
 SNDBUF, RCVBUF, or DELAY)
<DT><B>Returns:</B><DD>numeric value for specified option or -1 if the
  value is not available.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the option identifier is
  not valid
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if the connection was closed<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/SocketConnection.html#setSocketOption(byte, int)"><CODE>setSocketOption(byte, int)</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getLocalAddress()"><!-- --></A><H3>
getLocalAddress</H3>
<PRE>
public <A HREF="../../../java/lang/String.html" title="class in java.lang">String</A> <B>getLocalAddress</B>()
                       throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Gets the local address to which the socket is bound.

 <P>The host address(IP number) that can be used to connect to this
 end of the socket connection from an external system.
 Since IP addresses may be dynamically assigned, a remote application
 will need to be robust in the face of IP number reasssignment.</P>
 <P> The local hostname (if available) can be accessed from
 <code> System.getProperty("microedition.hostname")</code>
 </P>
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>the local address to which the socket is bound.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if the connection was closed.<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/ServerSocketConnection.html" title="interface in javax.microedition.io"><CODE>ServerSocketConnection</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getLocalPort()"><!-- --></A><H3>
getLocalPort</H3>
<PRE>
public int <B>getLocalPort</B>()
                 throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Returns the local port to which this socket is bound.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>the local port number to which this socket is connected.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if the connection was closed.<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/io/ServerSocketConnection.html" title="interface in javax.microedition.io"><CODE>ServerSocketConnection</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getAddress()"><!-- --></A><H3>
getAddress</H3>
<PRE>
public <A HREF="../../../java/lang/String.html" title="class in java.lang">String</A> <B>getAddress</B>()
                  throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Gets the remote address to which the socket is bound.
 The address can be either the remote host name or the IP
 address(if available).
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>the remote address to which the socket is bound.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if the connection was closed.</DL>
</DD>
</DL>
<HR>

<A NAME="getPort()"><!-- --></A><H3>
getPort</H3>
<PRE>
public int <B>getPort</B>()
            throws <A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></PRE>
<DL>
<DD>Returns the remote port to which this socket is bound.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>

<DT><B>Returns:</B><DD>the remote port number to which this socket is connected.
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../../java/io/IOException.html" title="class in java.io">IOException</A></CODE> - if the connection was closed.</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/SocketConnection.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/ServerSocketConnection.html" title="interface in javax.microedition.io"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../javax/microedition/io/StreamConnection.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="SocketConnection.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;CONSTR&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;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>
