SunSPOT host API V4.0


com.sun.spot.io.j2me.socket
Class SocketConnection

java.lang.Object
  extended by com.sun.spot.io.j2me.socket.SocketConnection

public class SocketConnection
extends Object

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)

Author:
Martin Morissette

Field Summary
static String DEFAULT_BASE_STATION_PORT
           
static int PACKET_TYPE_PORT_REQUEST
           
static int PACKET_TYPE_PORT_RESPONSE
           
static String SOCKET_PROXY_BASE_STATION_ADDRESS_MANIFEST_PROPERTY
           
static String SOCKET_PROXY_BASE_STATION_PORT_MANIFEST_PROPERTY
           
 
Constructor Summary
SocketConnection(ProxyInitializer initializer, boolean timeouts)
          Create a SocketConnection object.
 
Method Summary
 void close()
          Disconnect and close the SocketConnection.
 com.sun.spot.io.j2me.socket.SocketConnection.SocketInputStream getInputStream()
          Get a SocketInputStream object associated to this conneciton.
 com.sun.spot.io.j2me.socket.SocketConnection.SocketOutputStream getOutputStream()
          Get a SocketOutputStream object associated to this conneciton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOCKET_PROXY_BASE_STATION_ADDRESS_MANIFEST_PROPERTY

public static final String SOCKET_PROXY_BASE_STATION_ADDRESS_MANIFEST_PROPERTY
See Also:
Constant Field Values

SOCKET_PROXY_BASE_STATION_PORT_MANIFEST_PROPERTY

public static final String SOCKET_PROXY_BASE_STATION_PORT_MANIFEST_PROPERTY
See Also:
Constant Field Values

DEFAULT_BASE_STATION_PORT

public static final String DEFAULT_BASE_STATION_PORT
See Also:
Constant Field Values

PACKET_TYPE_PORT_REQUEST

public static final int PACKET_TYPE_PORT_REQUEST
See Also:
Constant Field Values

PACKET_TYPE_PORT_RESPONSE

public static final int PACKET_TYPE_PORT_RESPONSE
See Also:
Constant Field Values
Constructor Detail

SocketConnection

public SocketConnection(ProxyInitializer initializer,
                        boolean timeouts)
                 throws IllegalArgumentException,
                        IOException
Create a SocketConnection object.

Parameters:
initializer - Initializer string to send the proxy to init the connection.
timeouts - set to true to use timeouts
Throws:
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.
Method Detail

getInputStream

public com.sun.spot.io.j2me.socket.SocketConnection.SocketInputStream getInputStream()
                                                                              throws IOException
Get a SocketInputStream object associated to this conneciton.

Returns:
a SocketInputStream object associated to this conneciton.
Throws:
IOException

getOutputStream

public com.sun.spot.io.j2me.socket.SocketConnection.SocketOutputStream getOutputStream()
                                                                                throws IOException
Get a SocketOutputStream object associated to this conneciton.

Returns:
a SocketOutputStream object associated to this conneciton.
Throws:
IOException

close

public void close()
           throws IOException
Disconnect and close the SocketConnection.

Throws:
IOException

SunSPOT host API V4.0


Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved.