|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.spot.io.j2me.socket.SocketConnection
public class SocketConnection
This class provides the necessary implementation for a socket connection.
A SocketProxy must be running on the desktop in order to properly establish a connection.
The SocketConnection uses the following Manifest properties to establish the connection:
"com.sun.spot.io.j2me.socket.SocketConnection-BaseStationAddress" : IEEE address of the base station where the SocketProxy is running (can also be set as an argument to the VM)
"com.sun.spot.io.j2me.socket.SocketConnection-BaseStationPort" : Radiogram port to connect to, where the SocketProxy is running. (can also be set as an argument to the VM)
| Nested Class Summary | |
|---|---|
class |
SocketConnection.SocketInputStream
Socket specific input stream. |
| Field Summary | |
|---|---|
protected String |
basestationAddress
|
protected OutputStream |
confirmStream
|
protected StreamConnection |
conn
|
protected boolean |
connected
|
protected static SocketConnection[] |
connections
|
static String |
DEFAULT_BASE_STATION_PORT
|
static Object |
DO_REQUEST_LOCK
|
protected int |
opens
|
static int |
PACKET_TYPE_INET_GET_BY_NAME_REQUEST
|
static int |
PACKET_TYPE_INET_GET_BY_NAME_RESPONSE
|
static int |
PACKET_TYPE_INET_GETLOCALHOST_REQUEST
|
static int |
PACKET_TYPE_INET_GETLOCALHOST_RESPONSE
|
static int |
PACKET_TYPE_KILL_REQUEST
|
static int |
PACKET_TYPE_KILL_RESPONSE
|
static int |
PACKET_TYPE_MULTICAST_PORT_REQUEST
|
static int |
PACKET_TYPE_MULTICAST_PORT_RESPONSE
|
static int |
PACKET_TYPE_PORT_REQUEST
|
static int |
PACKET_TYPE_PORT_RESPONSE
|
protected int |
port
|
static String |
SOCKET_PROXY_BASE_STATION_ADDRESS_MANIFEST_PROPERTY
|
static String |
SOCKET_PROXY_BASE_STATION_PORT_MANIFEST_PROPERTY
|
static String |
SOCKET_PROXY_PROXY_DISCOVER_RADIUS_MANIFEST_PROPERTY
|
static int |
SPOT_GLOBALS_FIRST_DO_SOCKET_KEY
|
| Constructor Summary | |
|---|---|
SocketConnection(ProxyInitializer initializer,
boolean timeouts)
Create a SocketConnection object. |
|
SocketConnection(String baseStationAddress,
int radioPort,
boolean timeouts,
OutputStream confirmStream)
|
|
| Method Summary | |
|---|---|
void |
close()
Disconnect and close the SocketConnection. |
protected void |
disconnect()
Disconnect and close the SocketConnection. |
static String |
doSocketProxyRequest(int requestType,
String string,
boolean timeouts,
SocketConnection socketConnection,
DatagramConnectionImpl datagramConnectionImpl)
|
static String |
doSocketProxyRequestPrim(int requestType,
String string,
boolean timeouts,
SocketConnection socketConnection,
DatagramConnectionImpl datagramConnectionImpl)
|
static String |
getAddressByHost(String host)
Perform a DNS lookup on the host over a radidostream connection. |
SocketConnection.SocketInputStream |
getInputStream()
Get a SocketInputStream object associated to this conneciton. |
static String |
getLocalHost()
|
com.sun.spot.io.j2me.socket.SocketConnection.SocketOutputStream |
getOutputStream()
Get a SocketOutputStream object associated to this conneciton. |
protected void |
init(String baseStationAddress,
int radioPort,
boolean timeouts)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SPOT_GLOBALS_FIRST_DO_SOCKET_KEY
public static final String SOCKET_PROXY_BASE_STATION_ADDRESS_MANIFEST_PROPERTY
public static final String SOCKET_PROXY_BASE_STATION_PORT_MANIFEST_PROPERTY
public static final String SOCKET_PROXY_PROXY_DISCOVER_RADIUS_MANIFEST_PROPERTY
public static final String DEFAULT_BASE_STATION_PORT
public static final int PACKET_TYPE_KILL_REQUEST
public static final int PACKET_TYPE_KILL_RESPONSE
public static final int PACKET_TYPE_PORT_REQUEST
public static final int PACKET_TYPE_PORT_RESPONSE
public static final int PACKET_TYPE_MULTICAST_PORT_REQUEST
public static final int PACKET_TYPE_MULTICAST_PORT_RESPONSE
public static final int PACKET_TYPE_INET_GET_BY_NAME_REQUEST
public static final int PACKET_TYPE_INET_GET_BY_NAME_RESPONSE
public static final int PACKET_TYPE_INET_GETLOCALHOST_REQUEST
public static final int PACKET_TYPE_INET_GETLOCALHOST_RESPONSE
public static final Object DO_REQUEST_LOCK
protected static SocketConnection[] connections
protected StreamConnection conn
protected String basestationAddress
protected int port
protected OutputStream confirmStream
protected int opens
protected boolean connected
| Constructor Detail |
|---|
public SocketConnection(ProxyInitializer initializer,
boolean timeouts)
throws IllegalArgumentException,
IOException
initializer - Initializer string to send the proxy to init the connection.timeouts - set to true to use timeouts
IOException - when unable to establish the connection with the proxy
IllegalArgumentException - when the property "com.sun.spot.io.j2me.socket.SocketConnection-BaseStationAddress" is not set in the Manifest file or passed as an argument to the VM.
public SocketConnection(String baseStationAddress,
int radioPort,
boolean timeouts,
OutputStream confirmStream)
throws IllegalArgumentException,
IOException
IllegalArgumentException
IOException| Method Detail |
|---|
public static String doSocketProxyRequest(int requestType,
String string,
boolean timeouts,
SocketConnection socketConnection,
DatagramConnectionImpl datagramConnectionImpl)
throws IOException
IOException
public static String doSocketProxyRequestPrim(int requestType,
String string,
boolean timeouts,
SocketConnection socketConnection,
DatagramConnectionImpl datagramConnectionImpl)
throws IOException
IOException
public static String getAddressByHost(String host)
throws IOException
IOException
public static String getLocalHost()
throws IOException
IOException
protected void init(String baseStationAddress,
int radioPort,
boolean timeouts)
throws IOException
IOException
public SocketConnection.SocketInputStream getInputStream()
throws IOException
IOException
public com.sun.spot.io.j2me.socket.SocketConnection.SocketOutputStream getOutputStream()
throws IOException
IOException
protected void disconnect()
throws IOException
IOException
public void close()
throws IOException
IOException
|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||