Java Doc for DatagramPacket.java in  » 6.0-JDK-Modules » j2me » java » net » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.net 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.net.DatagramPacket

DatagramPacket
final public class DatagramPacket (Code)
This class represents a datagram packet.

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. Packet delivery is not guaranteed.
author:
   Pavani Diwanji
author:
   Benjamin Renaud
version:
   1.30, 02/02/00
since:
   JDK1.0



Field Summary
 InetAddressaddress
    
 byte[]buf
    
 intbufLength
    
 intlength
    
 intoffset
    
 intport
    

Constructor Summary
public  DatagramPacket(byte buf, int offset, int length)
     Constructs a DatagramPacket for receiving packets of length length, specifying an offset into the buffer.

The length argument must be less than or equal to buf.length.

public  DatagramPacket(byte buf, int length)
     Constructs a DatagramPacket for receiving packets of length length.
public  DatagramPacket(byte buf, int offset, int length, InetAddress address, int port)
     Constructs a datagram packet for sending packets of length length with offset ioffsetto the specified port number on the specified host.
public  DatagramPacket(byte buf, int offset, int length, SocketAddress address)
     Constructs a datagram packet for sending packets of length length with offset ioffsetto the specified port number on the specified host.
public  DatagramPacket(byte buf, int length, InetAddress address, int port)
     Constructs a datagram packet for sending packets of length length to the specified port number on the specified host.
public  DatagramPacket(byte buf, int length, SocketAddress address)
     Constructs a datagram packet for sending packets of length length to the specified port number on the specified host.

Method Summary
public synchronized  InetAddressgetAddress()
     Returns the IP address of the machine to which this datagram is being sent or from which the datagram was received.
public synchronized  byte[]getData()
     Returns the data buffer.
public synchronized  intgetLength()
     Returns the length of the data to be sent or the length of the data received.
public synchronized  intgetOffset()
     Returns the offset of the data to be sent or the offset of the data received.
public synchronized  intgetPort()
     Returns the port number on the remote host to which this datagram is being sent or from which the datagram was received.
public synchronized  SocketAddressgetSocketAddress()
     Gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from.
public synchronized  voidsetAddress(InetAddress iaddr)
     Sets the IP address of the machine to which this datagram is being sent.
public synchronized  voidsetData(byte[] buf, int offset, int length)
     Set the data buffer for this packet.
public synchronized  voidsetData(byte[] buf)
     Set the data buffer for this packet.
public synchronized  voidsetLength(int length)
     Set the length for this packet.
public synchronized  voidsetPort(int iport)
     Sets the port number on the remote host to which this datagram is being sent.
public synchronized  voidsetSocketAddress(SocketAddress address)
     Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram is being sent.

Field Detail
address
InetAddress address(Code)



buf
byte[] buf(Code)



bufLength
int bufLength(Code)



length
int length(Code)



offset
int offset(Code)



port
int port(Code)




Constructor Detail
DatagramPacket
public DatagramPacket(byte buf, int offset, int length)(Code)
Constructs a DatagramPacket for receiving packets of length length, specifying an offset into the buffer.

The length argument must be less than or equal to buf.length.
Parameters:
  buf - buffer for holding the incoming datagram.
Parameters:
  offset - the offset for the buffer
Parameters:
  length - the number of bytes to read.
since:
   JDK1.2




DatagramPacket
public DatagramPacket(byte buf, int length)(Code)
Constructs a DatagramPacket for receiving packets of length length.

The length argument must be less than or equal to buf.length.
Parameters:
  buf - buffer for holding the incoming datagram.
Parameters:
  length - the number of bytes to read.




DatagramPacket
public DatagramPacket(byte buf, int offset, int length, InetAddress address, int port)(Code)
Constructs a datagram packet for sending packets of length length with offset ioffsetto the specified port number on the specified host. The length argument must be less than or equal to buf.length.
Parameters:
  buf - the packet data.
Parameters:
  offset - the packet data offset.
Parameters:
  length - the packet data length.
Parameters:
  address - the destination address.
Parameters:
  port - the destination port number.
See Also:   java.net.InetAddress
since:
   JDK1.2



DatagramPacket
public DatagramPacket(byte buf, int offset, int length, SocketAddress address) throws SocketException(Code)
Constructs a datagram packet for sending packets of length length with offset ioffsetto the specified port number on the specified host. The length argument must be less than or equal to buf.length.
Parameters:
  buf - the packet data.
Parameters:
  offset - the packet data offset.
Parameters:
  length - the packet data length.
Parameters:
  address - the destination socket address.
throws:
  IllegalArgumentException - if address type is not supported
See Also:   java.net.InetAddress
since:
   1.4



DatagramPacket
public DatagramPacket(byte buf, int length, InetAddress address, int port)(Code)
Constructs a datagram packet for sending packets of length length to the specified port number on the specified host. The length argument must be less than or equal to buf.length.
Parameters:
  buf - the packet data.
Parameters:
  length - the packet length.
Parameters:
  address - the destination address.
Parameters:
  port - the destination port number.
See Also:   java.net.InetAddress



DatagramPacket
public DatagramPacket(byte buf, int length, SocketAddress address) throws SocketException(Code)
Constructs a datagram packet for sending packets of length length to the specified port number on the specified host. The length argument must be less than or equal to buf.length.
Parameters:
  buf - the packet data.
Parameters:
  length - the packet length.
Parameters:
  address - the destination address.
throws:
  IllegalArgumentException - if address type is not supported
since:
   1.4
See Also:   java.net.InetAddress




Method Detail
getAddress
public synchronized InetAddress getAddress()(Code)
Returns the IP address of the machine to which this datagram is being sent or from which the datagram was received. the IP address of the machine to which this datagram is beingsent or from which the datagram was received.
See Also:   java.net.InetAddress
See Also:   DatagramPacket.setAddress(java.net.InetAddress)



getData
public synchronized byte[] getData()(Code)
Returns the data buffer. The data received or the data to be sent starts from the offset in the buffer, and runs for length long. the buffer used to receive or send data
See Also:   DatagramPacket.setData(byte[],int,int)



getLength
public synchronized int getLength()(Code)
Returns the length of the data to be sent or the length of the data received. the length of the data to be sent or the length of thedata received.
See Also:   DatagramPacket.setLength(int)



getOffset
public synchronized int getOffset()(Code)
Returns the offset of the data to be sent or the offset of the data received. the offset of the data to be sent or the offset of thedata received.
since:
   JDK1.2



getPort
public synchronized int getPort()(Code)
Returns the port number on the remote host to which this datagram is being sent or from which the datagram was received. the port number on the remote host to which this datagram isbeing sent or from which the datagram was received.
See Also:   DatagramPacket.setPort(int)



getSocketAddress
public synchronized SocketAddress getSocketAddress()(Code)
Gets the SocketAddress (usually IP address + port number) of the remote host that this packet is being sent to or is coming from. the SocketAddress
since:
   1.4
See Also:   DatagramPacket.setSocketAddress



setAddress
public synchronized void setAddress(InetAddress iaddr)(Code)
Sets the IP address of the machine to which this datagram is being sent.
Parameters:
  iaddr - the InetAddress
since:
   JDK1.1
See Also:   DatagramPacket.getAddress()



setData
public synchronized void setData(byte[] buf, int offset, int length)(Code)
Set the data buffer for this packet. This sets the data, length and offset of the packet.
Parameters:
  buf - the buffer to set for this packet
Parameters:
  offset - the offset into the data
Parameters:
  length - the length of the data and/or the length of the buffer used to receive data
exception:
  NullPointerException - if the argument is null
See Also:   DatagramPacket.getData
See Also:   DatagramPacket.getOffset
See Also:   DatagramPacket.getLength
since:
   JDK1.2



setData
public synchronized void setData(byte[] buf)(Code)
Set the data buffer for this packet. With the offset of this DatagramPacket set to 0, and the length set to the length of buf.
Parameters:
  buf - the buffer to set for this packet.
exception:
  NullPointerException - if the argument is null.
See Also:   DatagramPacket.getLength
See Also:   DatagramPacket.getData
since:
   JDK1.1



setLength
public synchronized void setLength(int length)(Code)
Set the length for this packet. The length of the packet is the number of bytes from the packet's data buffer that will be sent, or the number of bytes of the packet's data buffer that will be used for receiving data. The length must be lesser or equal to the offset plus the length of the packet's buffer.
Parameters:
  length - the length to set for this packet.
exception:
  IllegalArgumentException - if the length is negativeof if the length is greater than the packet's data bufferlength.
See Also:   DatagramPacket.getLength
See Also:   DatagramPacket.setData
since:
   JDK1.1



setPort
public synchronized void setPort(int iport)(Code)
Sets the port number on the remote host to which this datagram is being sent.
Parameters:
  iport - the port number
since:
   JDK1.1
See Also:   DatagramPacket.getPort()



setSocketAddress
public synchronized void setSocketAddress(SocketAddress address)(Code)
Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram is being sent.
Parameters:
  address - the SocketAddress
throws:
  IllegalArgumentException - if address is null or is aSocketAddress subclass not supported by this socket
since:
   1.4
See Also:   DatagramPacket.getSocketAddress



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.