java.net
Class Socket

java.lang.Object
  extended by java.net.Socket

public class Socket
extends Object

Socket. Allows a NXT to establish a connection with a remote Socket server via a proxy server. Version 1.1 uses NXTConnection and does not need to distinguish between USB and Bluetooth.

Version:
1.1
Author:
Ranulf Green & Lawrie Griffiths

Constructor Summary
Socket()
          Constructor.
Socket(String host, int port)
          Constructor: Pass an open NXT connection and socket details.
 
Method Summary
 void close()
          Write Escape sequence to indicate end of file
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Socket

public Socket(String host,
              int port)
       throws IOException
Constructor: Pass an open NXT connection and socket details.

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

Socket

public Socket()
Constructor. Use if the socket is intended not to connect to a host

Method Detail

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

close

public void close()
Write Escape sequence to indicate end of file