Name

StreamConnectionNotifier

Synopsis

StreamConnectionNotifier is a type of Connection returned when the application invokes the Connector open() method with the name argument of the form socket://:port. This creates a server socket, which listens for connections from clients and creates a StreamConnection for each connection received.

Connections can be retrieved by calling the acceptAndOpen() method, which blocks until a connection is available. Application code will normally loop through calling this method and creating a new thread to service each connection. Invoking the StreamConnectionNotifier close() method causes acceptAndOpen() to throw an IOException, which can be used to break out of such a loop.

                  Returned By
public interface StreamConnectionNotifier extends Connection {  
// Public Instance Methods
   public abstract StreamConnection acceptAndOpen(
        ) throws java.io.IOException;  
}

Get J2ME in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.