public class RangePortSrvrChan extends java.lang.Object implements SrvrChan
The backchannel is the core of the EventWeb system. It provides the connection between a EventWeb server and a EventWeb client.
RangePortSrvrChan creates backchannel ports within a specified range.
| Modifier and Type | Field and Description |
|---|---|
protected static byte |
ACTIVE
Port is in use
|
protected static byte |
BLOCKED
Port is used by another application
|
protected static int |
blockedCnt |
protected static eventweb.net.srvr.RangePortSrvrChan.portChecker |
checker |
static int |
DEF_MAX_PORT
Default maximum port address
|
static int |
DEF_MIN_PORT
Default minimum port address
|
static java.lang.String[] |
DEP_LIST
Class dependencies.
|
protected static byte |
FREE
Port is available for use
|
protected static int |
maxPort
Maximum port address
|
int |
mimeTypeId
Id for MIME type used by this channel.
|
protected static int |
minPort
Minimum port address
|
java.lang.String |
name
Identifying name for channel.
|
protected static int |
PORT_CHECK_INTERVAL |
protected static byte[] |
portList |
java.io.BufferedReader |
reader
Reader for channel.
|
protected static java.net.ServerSocket |
savedSrvSocket |
TvReader |
tvReader
Tag-Value reader for channel.
|
TvWriter |
tvWriter
Tag-Value writer for channel.
|
static java.lang.String |
VERSION
Class version.
|
java.io.PrintWriter |
writer
Writer for channel.
|
IF_VERSION| Constructor and Description |
|---|
RangePortSrvrChan(int commMode,
int connectTimeout,
int activityTimeout,
java.io.BufferedReader fcFromClient,
java.io.PrintWriter fcToClient)
Create a new RangePortSrvrChan.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Disconnect the client.
|
protected void |
closeServerSocket(java.net.ServerSocket socket)
Close a ServerSocket
|
static boolean |
configureClass(int minPortNum,
int maxPortNum)
Configure the class.
|
int |
connect(SesnKey bcCliSesKey,
SesnKey bcSrvSesKey,
int mimeTypeId)
Accept a client connection.
|
int |
getMimeTypeId()
Get the channel MIME type.
|
java.lang.String |
getName()
Get the channel identifier.
|
int |
getPort()
Get the local port assigned to the channel.
|
java.io.BufferedReader |
getReader()
Get the channel reader.
|
TvList |
getRec()
Read a record from the channel.
|
protected java.net.ServerSocket |
getServerSocket()
Get a ServerSocket
|
TvReader |
getTvReader()
Get the channel tag-value reader.
|
TvWriter |
getTvWriter()
Get the channel tag-value writer.
|
java.io.PrintWriter |
getWriter()
Get the channel writer.
|
void |
putRec(java.lang.String tag,
java.lang.String value)
Write a tag value pair as a single record.
|
void |
putRec(TvList data)
Write a tag-value list as a single record.
|
java.lang.String |
toString()
Get an identifying description of the channel.
|
public static final java.lang.String VERSION
public static final java.lang.String[] DEP_LIST
public static final int DEF_MIN_PORT
public static final int DEF_MAX_PORT
public java.io.BufferedReader reader
public java.io.PrintWriter writer
public TvReader tvReader
public TvWriter tvWriter
public java.lang.String name
public int mimeTypeId
MimeTypeprotected static final byte FREE
protected static final byte ACTIVE
protected static final byte BLOCKED
protected static final int PORT_CHECK_INTERVAL
protected static int minPort
protected static int maxPort
protected static byte[] portList
protected static int blockedCnt
protected static java.net.ServerSocket savedSrvSocket
protected static eventweb.net.srvr.RangePortSrvrChan.portChecker checker
public RangePortSrvrChan(int commMode,
int connectTimeout,
int activityTimeout,
java.io.BufferedReader fcFromClient,
java.io.PrintWriter fcToClient)
throws java.io.IOException
commMode - Communications modeconnectTimeout - Time allowed for client to connect [ms]activityTimeout - Time to hold channel open with no activity [ms]fcFromClient - Frontchannel connection from clientfcToClient - Frontchannel connection to clientjava.io.IOException - If there is a failure at the TCP levelpublic static boolean configureClass(int minPortNum,
int maxPortNum)
minPortNum - Minimum port addressmaxPortNum - Maximum port addresspublic int getPort()
public int connect(SesnKey bcCliSesKey, SesnKey bcSrvSesKey, int mimeTypeId) throws java.io.IOException
connect in interface SrvrChanbcCliSesKey - Client session keybcSrvSesKey - Server session keymimeTypeId - MIME type for communication on the channel.java.io.IOException - If the connection fails at the TCP levelMimeTypepublic java.lang.String getName()
public int getMimeTypeId()
getMimeTypeId in interface SrvrChanpublic TvList getRec() throws java.io.IOException
public void putRec(java.lang.String tag,
java.lang.String value)
public void putRec(TvList data)
public TvReader getTvReader()
getTvReader in interface SrvrChanpublic TvWriter getTvWriter()
getTvWriter in interface SrvrChanpublic java.io.BufferedReader getReader()
public java.io.PrintWriter getWriter()
public java.lang.String toString()
protected java.net.ServerSocket getServerSocket()
protected void closeServerSocket(java.net.ServerSocket socket)
throws java.io.IOException
java.io.IOException - If an I/o error occurs when closing the socket