Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lejos.nxt.comm
Class NXTSocket

    java.lang.Object
      lejos.nxt.comm.NXTSocket

    public class NXTSocket

extends Object

NXTSocket. Allows a NXT to establish a connection with a remote Socket server via a proxy server.

Version:
  1.0
Author:
  Ranulf Green

Constructor Summary
`NXTSocket(BTConnection btc)` Constructor.
`NXTSocket(String host, int port, BTConnection btc)` Constructor: Pass an open bluetooth connection and socket details.
`NXTSocket(String host, int port, USBConnection usbc)` Constructor: Pass an open USB connection and socket details.
`NXTSocket(USBConnection usbc)` Constructor for usb connnection.

Method Summary
`DataInputStream` | `getDataInputStream()` Returns the data input stream of the socket
`DataOutputStream` | `getDataOutputStream()` Returns the data output stream of the socket
`InputStream` | `getInputStream()` Returns the input stream associated with this socket
`OutputStream` | `getOutputStream()` Returns the output stream associated with this socket

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait`

Constructor Detail

### NXTSocket

    public NXTSocket(String host,
                     int port,
                     BTConnection btc)
              throws IOException

  Constructor: Pass an open bluetooth connection and socket details.

  Parameters:
    `host` - The name of the host with which the socket will be opened
    `port` - The port to connect to
    `btc` - The bluetooth connection
  Throws:
    `IOException` - If the bluetooth does not respond or the proxy is not running

### NXTSocket

    public NXTSocket(String host,
                     int port,
                     USBConnection usbc)
              throws IOException

  Constructor: Pass an open USB connection and socket details.

  Parameters:
    `host` - The name of the host with which the socket will be opened
    `port` - The port to connect to
    `usbc` - The USB connection
  Throws:
    `IOException` - If the bluetooth does not respond or the proxy is not running

### NXTSocket

    public NXTSocket(BTConnection btc)

  Constructor. Use if the socket is intended not to connect to a host

  Parameters:
    `btc` - the connection the socket is made over

### NXTSocket

    public NXTSocket(USBConnection usbc)

  Constructor for usb connnection. Does not connect to a host

  Parameters:
    `usbc` - The USB connection to use;

Method Detail

### getDataInputStream

    public DataInputStream getDataInputStream()
                                       throws IOException

  Returns the data input stream of the socket

  Returns:
    The data input stream of the socket
  Throws:
    `IOException`

### getDataOutputStream

    public DataOutputStream getDataOutputStream()
                                         throws IOException

  Returns the data output stream of the socket

  Returns:
    The data output stream of the socket
  Throws:
    `IOException`

### getOutputStream

    public OutputStream getOutputStream()
                                 throws IOException

  Returns the output stream associated with this socket

  Returns:
    The output stream
  Throws:
    `IOException`

### getInputStream

    public InputStream getInputStream()
                               throws IOException

  Returns the input stream associated with this socket

  Returns:
    The input stream
  Throws:
    `IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD