com.syncbuilder.sync
Class ServerSocket

java.lang.Object
  |
  +--com.syncbuilder.sync.ServerSocket

public class ServerSocket
extends java.lang.Object

A representation of a Server socket.
After its creation this socket sits there and waits for an incoming connection from a PalmOS device. When a connection is established via accept(), a Link object is returned.

See Also:
Link, Dlp, Socket

Constructor Summary
ServerSocket(java.lang.String device)
          Construct a ServerSocket and bind it to a device.
 
Method Summary
 Link accept()
          Wait for an incoming connection.
This is a blocking call that returns as soon as a connection could successfully be established.
 Link accept(int timeout)
          Wait for an incoming connection with time-out.
This is a blocking call that returns as soon as a connection could successfully be established, or when the specified time-out has been reached.
A Link object will be returned, through which you can conduct all further communication.
 void bind(java.lang.String device)
           
 void close()
          Close the ServerSocket.
This stops the ServerSocket from accepting clients.
 int getMaxConnections()
          Return the maximum number of simultaneous connections which can be handled by this ServerSocket.
 void listen(int backlog)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerSocket

public ServerSocket(java.lang.String device)
             throws java.io.IOException
Construct a ServerSocket and bind it to a device. Then make it listen for incoming connections.
Parameters:
device - the name of the device. This is platform-dependent!
Method Detail

accept

public Link accept()
            throws java.io.IOException
Wait for an incoming connection.
This is a blocking call that returns as soon as a connection could successfully be established. A Link object will be returned, through which you can conduct all further communication.

accept

public Link accept(int timeout)
            throws java.io.IOException
Wait for an incoming connection with time-out.
This is a blocking call that returns as soon as a connection could successfully be established, or when the specified time-out has been reached.
A Link object will be returned, through which you can conduct all further communication.
Throws:
java.io.InterruptedIOException - the timeout has expired

bind

public void bind(java.lang.String device)
          throws java.io.IOException

listen

public void listen(int backlog)
            throws java.io.IOException

getMaxConnections

public int getMaxConnections()
Return the maximum number of simultaneous connections which can be handled by this ServerSocket. The result of this method depends on the underlying implementation of the ServerSocket.
Returns:
a number between 1 and Integer.MAX_VALUE

close

public void close()
           throws java.io.IOException,
                  DlpException
Close the ServerSocket.
This stops the ServerSocket from accepting clients.


This material is Copyrighted (C) 1999 by Tilo Christ. All Rights Reserved.