<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.net.DatagramPacket
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.net.html">This Package</a>  <a href="java.net.ContentHandler.html#_top_">Previous</a>  <a href="java.net.DatagramSocket.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.net.DatagramPacket
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----java.net.DatagramPacket
</pre>
<hr>
<dl>
  <dt> public final class <b>DatagramPacket</b>
  <dt> extends <a href="java.lang.Object.html#_top_">Object</a>
</dl>
This class represents a datagram packet. 
 <p>
 Datagram packets are used to implement a connectionless packet 
 delivery service. Each message is routed from one machine to 
 another based solely on information contained within that packet. 
 Multiple packets sent from one machine to another might be routed 
 differently, and might arrive in any order.
<p>
<hr>
<a name="index"></a>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#DatagramPacket(byte[], int)"><b>DatagramPacket</b></a>(byte[], int)
  <dd>  Constructs a <code>DatagramPacket</code> for receiving packets of 
 length <code>ilength</code>.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#DatagramPacket(byte[], int, java.net.InetAddress, int)"><b>DatagramPacket</b></a>(byte[], int, InetAddress, int)
  <dd>  Constructs a datagram packet for sending packets of length 
 <code>ilength</code> to the specified port number on the specified 
 host.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getAddress()"><b>getAddress</b></a>()
  <dd>  Returns the IP address of the machine to which this datagram is being
 sent or from which the datagram was received.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getData()"><b>getData</b></a>()
  <dd>  Returns the data received or the data to be sent.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getLength()"><b>getLength</b></a>()
  <dd>  Returns the length of the data to be sent or the length of the
 data received.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getPort()"><b>getPort</b></a>()
  <dd>  Returns the port number on the remote host to which this datagram is
 being sent or from which the datagram was received.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setAddress(java.net.InetAddress)"><b>setAddress</b></a>(InetAddress)
  <dd>  
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setData(byte[])"><b>setData</b></a>(byte[])
  <dd>  
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setLength(int)"><b>setLength</b></a>(int)
  <dd>  
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setPort(int)"><b>setPort</b></a>(int)
  <dd>  
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="DatagramPacket"></a>
<a name="DatagramPacket(byte[], int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>DatagramPacket</b>
<pre>
 public DatagramPacket(byte ibuf[],
                       int ilength)
</pre>
<dl>
  <dd> Constructs a <code>DatagramPacket</code> for receiving packets of 
 length <code>ilength</code>. 
 <p>
 The <code>length</code> argument must be less than or equal to 
 <code>ibuf.length</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> ibuf - buffer for holding the incoming datagram.
    <dd> ilength - the number of bytes to read.
  </dl></dd>
</dl>
<a name="DatagramPacket(byte[], int, java.net.InetAddress, int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>DatagramPacket</b>
<pre>
 public DatagramPacket(byte ibuf[],
                       int ilength,
                       <a href="java.net.InetAddress.html#_top_">InetAddress</a> iaddr,
                       int iport)
</pre>
<dl>
  <dd> Constructs a datagram packet for sending packets of length 
 <code>ilength</code> to the specified port number on the specified 
 host. The <code>length</code> argument must be less than or equal 
 to <code>ibuf.length</code>.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> ibuf - the packet data.
    <dd> ilength - the packet length.
    <dd> iaddr - the destination address.
    <dd> iport - the destination port number.
    <dt> <b>See Also:</b>
    <dd> <a href="java.net.InetAddress.html#_top_">InetAddress</a>
  </dl></dd>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="getAddress()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getAddress"><b>getAddress</b></a>
<pre>
 public synchronized <a href="java.net.InetAddress.html#_top_">InetAddress</a> getAddress()
</pre>
<dl>
  <dd> Returns the IP address of the machine to which this datagram is being
 sent or from which the datagram was received.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the IP address of the machine to which this datagram is being
          sent or from which the datagram was received.
    <dt> <b>See Also:</b>
    <dd> <a href="java.net.InetAddress.html#_top_">InetAddress</a>
  </dl></dd>
</dl>
<a name="getPort()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getPort"><b>getPort</b></a>
<pre>
 public synchronized int getPort()
</pre>
<dl>
  <dd> Returns the port number on the remote host to which this datagram is
 being sent or from which the datagram was received.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the port number on the remote host to which this datagram is
          being sent or from which the datagram was received.
  </dl></dd>
</dl>
<a name="getData()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getData"><b>getData</b></a>
<pre>
 public synchronized byte[] getData()
</pre>
<dl>
  <dd> Returns the data received or the data to be sent.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the data received or the data to be sent.
  </dl></dd>
</dl>
<a name="getLength()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getLength"><b>getLength</b></a>
<pre>
 public synchronized int getLength()
</pre>
<dl>
  <dd> Returns the length of the data to be sent or the length of the
 data received.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the length of the data to be sent or the length of the
          data received.
  </dl></dd>
</dl>
<a name="setAddress(java.net.InetAddress)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setAddress"><b>setAddress</b></a>
<pre>
 public synchronized void setAddress(<a href="java.net.InetAddress.html#_top_">InetAddress</a> iaddr)
</pre>
<dl>
</dl>
<a name="setPort(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setPort"><b>setPort</b></a>
<pre>
 public synchronized void setPort(int iport)
</pre>
<dl>
</dl>
<a name="setData(byte[])"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setData"><b>setData</b></a>
<pre>
 public synchronized void setData(byte ibuf[])
</pre>
<dl>
</dl>
<a name="setLength(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setLength"><b>setLength</b></a>
<pre>
 public synchronized void setLength(int ilength)
</pre>
<dl>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.net.html">This Package</a>  <a href="java.net.ContentHandler.html#_top_">Previous</a>  <a href="java.net.DatagramSocket.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
