com.sun.spot.io.j2me.radiostream
Interface RadiostreamConnection
- All Superinterfaces:
- Connection, InputConnection, IRadioControl, ITimeoutableConnection, OutputConnection, StreamConnection
- All Known Subinterfaces:
- RadioConnection
- All Known Implementing Classes:
- Protocol
public interface RadiostreamConnection
- extends ITimeoutableConnection, IRadioControl, StreamConnection
This interface defines the "radiostream" protocol.
The radiostream protocol is a socket-like peer-to-peer protocol that provides reliable, buffered
stream-based IO between two devices.
IMPORTANT This protocol is provided for test purposes and to allow creation of simple
demonstrations. It is NOT designed to be used as the base for higher level or more complex
protocols. If you want to create something more sophisticated write a new protocol that
calls the RadioPacketDispatcher
or LowPan
directly. See IProtocolManager
for more information.
To open a connection do:
...
StreamConnection conn = (StreamConnection) Connector.open("radiostream://destinationAddr:portNo");
...
where destinationAddr is the 64 bit IEEE Address of the radio at the far end, and portNo is a
port number in the range 0 to 127 that identifies this particular connection. Note that 0 is not
a valid IEEE address in this implementation.
To establish a bi-directional connection both ends must open connections specifying the same portNo
and corresponding IEEE addresses.
Port numbers between 0 and 31 are reserved for system services. Use by applications may result in conflicts.
Once the connection has been opened, each end can obtain streams to use to send and receive data, eg:
...
DataInputStream dis = conn.openDataInputStream();
DataOutputStream dos = conn.openDataOutputStream();
...
Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.