SunSPOT API V3.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 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
equals, 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
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 API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.