|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface defines the capabilities that a datagram connection must have.
The paramter string describing the target of the connection takes the form:
{protocol}:{target}If the {target} can't be resolved to a remote address, because it is incompletely specified, then it will be assumed to be the local address of the application, which is behaving as a "server". By "server", this means that a remote application initiates communication with the local application "server", because the local application's address is well known.
E.g. the "target" can be {host}:{port} (but is not necessarily limited to this.)
e.g. connection for accepting remote http socket connections:
http://
e.g. connection to a web server
http://www.nokia.com
e.g. another connection to a web server
http://www.mybank.com:8000
e.g. a datagram connection for accepting datagrams
datagram://:1234
e.g. a datagram connection for sending to a server:
datagram://123.456.789.12:1234
Note that the port number in "server mode" (unspecified host name) is the receiving port; and the port number in "client mode" (host name specified) is the target port. The reply to port in both cases is actually unspecified. In "server mode", it is reasonable to assume that the same port number is used for both receiving and sending. In "client mode", we must assume the reply-to port will be dynamically allocated.
Method Summary | |
String |
getAddress()
Get the address represented by this datagram endpoint. |
int |
getMaximumLength()
Get the maximum length a datagram can be. |
int |
getNominalLength()
Get the nominal length of a datagram. |
Datagram |
newDatagram(byte[] buf,
int size)
Make a new datagram object |
Datagram |
newDatagram(byte[] buf,
int size,
String addr)
Make a new datagram object |
Datagram |
newDatagram(int size)
Make a new datagram object automatically allocating a buffer |
void |
receive(Datagram dgram)
Receive a datagram |
void |
send(Datagram dgram)
Send a datagram |
Methods inherited from interface javax.microedition.io.Connection |
close,
open,
open |
Method Detail |
public String getAddress() throws IOException
public int getMaximumLength() throws IOException
public int getNominalLength() throws IOException
public void send(Datagram dgram) throws IOException
dgram
- A datagrampublic void receive(Datagram dgram) throws IOException
dgram
- A datagrampublic Datagram newDatagram(int size) throws IOException
public Datagram newDatagram(byte[] buf, int size) throws IOException
buf
- The buffer to be used in the datagrampublic Datagram newDatagram(byte[] buf, int size, String addr) throws IOException
buf
- The buffer to be used in the datagramaddr
- The address to which the datagram must go
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |