"

2013 FRC Java API

"

com.sun.squawk.io.j2me.serversocket
Class Protocol

java.lang.Object
  extended by com.sun.squawk.io.ConnectionBase
      extended by com.sun.squawk.io.j2me.serversocket.Protocol
All Implemented Interfaces:
Connection, ServerSocketConnection, StreamConnectionNotifier

public class Protocol
extends ConnectionBase
implements StreamConnectionNotifier, ServerSocketConnection

StreamConnectionNotifier for Server Socket API.

Version:
1.0 10/08/99
Author:
Nik Shaylor

Constructor Summary
Protocol()
           
 
Method Summary
 StreamConnection acceptAndOpen()
          Returns a GenericConnection that represents a server side socket connection
 void close()
          Close the connection.
 String getLocalAddress()
          Gets the local address to which the socket is bound.
 int getLocalPort()
          Returns the local port to which this socket is bound.
 Connection open(String protocol, String name, int mode, boolean timeouts)
          Open the connection
 
Methods inherited from class com.sun.squawk.io.ConnectionBase
openDataInputStream, openDataOutputStream, openInputStream, openOutputStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Protocol

public Protocol()
Method Detail

open

public Connection open(String protocol,
                       String name,
                       int mode,
                       boolean timeouts)
                throws IOException
Open the connection

Specified by:
open in class ConnectionBase
Parameters:
name - the target for the connection
mode - a flag that is true if the caller expects to write to the connection.
timeouts - A flag to indicate that the called wants timeout exceptions

The name string for this protocol should be: "

protocol - The URL protocol
Returns:
A new Connection object
Throws:
IOException
ConnectionNotFoundException - If the connection cannot be found.

acceptAndOpen

public StreamConnection acceptAndOpen()
                               throws IOException
Returns a GenericConnection that represents a server side socket connection

Specified by:
acceptAndOpen in interface StreamConnectionNotifier
Returns:
a socket to communicate with a client.
Throws:
IOException - if an I/O error occurs when creating the input stream.

close

public void close()
           throws IOException
Close the connection.

Specified by:
close in interface Connection
Overrides:
close in class ConnectionBase
Throws:
IOException - if an I/O error occurs when closing the connection.

getLocalAddress

public String getLocalAddress()
                       throws IOException
Description copied from interface: ServerSocketConnection
Gets the local address to which the socket is bound.

The host address(IP number) that can be used to connect to this end of the socket connection from an external system. Since IP addresses may be dynamically assigned, a remote application will need to be robust in the face of IP number reasssignment.

The local hostname (if available) can be accessed from System.getProperty("microedition.hostname")

Specified by:
getLocalAddress in interface ServerSocketConnection
Returns:
the local address to which the socket is bound.
Throws:
IOException - if the connection was closed
See Also:
SocketConnection

getLocalPort

public int getLocalPort()
                 throws IOException
Description copied from interface: ServerSocketConnection
Returns the local port to which this socket is bound.

Specified by:
getLocalPort in interface ServerSocketConnection
Returns:
the local port number to which this socket is connected.
Throws:
IOException - if the connection was closed
See Also:
SocketConnection

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"