Servertec SocketHandler
Content
Introduction
Release Notes
Features
FAQs
Requirements
Installation
Add-ons
How To
Change Log
Future Plans
Knowledge Base
Documentation
Conventions
Command Line
Administrator
Localization
Programming
Security
Performance
Deployment
Java API
AccessLogEntry
Codecs
Connection
ConnectionPool...
DString
ErrorLogEntry
EventLogEntry
FileCache
FileUpload
IOHandler
IOManager
iws
Logger
MonitorEvent...
MultiPartForm
QuickSort
Realm
RealmAdmin...
RealmManager
ServletContextImpl
ServletContext...
ServletImpl
ServletManager
SocketHandler
Utils

Servlet API
CGI
SSI
Servlets
Config Files
Log Files
Classes
Directory Tree
Samples
Legal
Contact Us

 

java.lang.Object
 |
 +--stec.iws.SocketHandler

public abstract SocketHandler

Defines methods used by Servertec Internet Server to access open a ServerSocket and Socket.

Methods

Method Description
destroy Called by the server to destroy the SocketHandler.
getServerSocket Returns a new ServerSocket.
getSocket Returns a new Socket.
init Called by the server to initialize the SocketHandler.

destroy

Called by the server to destroy the SocketHandler.

Syntax

public void destroy()

Parameters

None

Returns

Nothing

Throws

Nothing

Example

public void destroy()
{
  super.destroy();
}

getServerSocket

Returns a new ServerSocket.

Syntax

public ServerSocket getServerSocket(int port,
                                    int backlog,
                                    String address)
                                    throws Exception

Parameters

port the port number the ServerSocket listens on.
backlog the maximum number of pending request to queue.
address the IP address or the host name to listen to.

Returns

ServerSocket the new ServerSocket.

Throws

Exception Thrown when any error occurs.

Example


public ServerSocket getServerSocket(int port,
                                    int backlog,
                                    String address)
                                    throws Exception
{
  if(address == null)
  {
    return new ServerSocket(port, backlog);
  }
  else
  {
    InetAddress iaddress = InetAddress.getByName(address);
    return new ServerSocket(port, backlog, iaddress);
  }
}

getSocket

Returns a new Socket.

Syntax

public Socket getSocket(String hostname, int port)
    throws Exception

Parameters

hostname the name or IP address of the server to open a socket to.
port the port number to use.

Returns

Socket the new Socket.

Throws

Exception Thrown when any error occurs.

Example


public Socket getSocket(String hostname, int port)
    throws Exception
{
  return new Socket(hostname, port);
}

init

Called by the server to initialize the SocketHandler.

Syntax

public void init(Hashtable parameters) throws Exception

Parameters

parameters contains any initialization paramters

Returns

Nothing

Throws

Exception Thrown when any error occurs.

Example


private String[] cipher_suites;

public void init(Hahstable parameters) throws Exception
{
  super.init(parameters);

  Object obj = parameters.get("cipher_suites");
  if(obj = null)
  {
    cipher_suites = null;
  }
  else
  {
    cipher_suites = (String[])obj;
  }
}
 top of page
Copyright © 1998-2005 Servertec. All rights reserved.
Privacy Statement.
Last Modified: Sun Sep 04 14:56:49 EDT 2005