|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread biz.chitec.quarterback.gjsa.server.SocketLayer
Lowest-level class in server-socket-communication A SocketLayer object is created by GJSAServer for each incoming connection. It always runs in its own thread. It does always the initial and the low-level stuff on the connection:
ServerThreadBase
,
GJSAServer
,
SessionConnector
Nested Class Summary | |
private class |
SocketLayer.InternalHandlingException
|
Field Summary | |
private java.lang.String |
clienthostip
The client IP address |
private java.lang.String |
clienthostname
The (DNS-)name of the client host |
private int |
connectionencoding
What is the encoding of the connection? |
private boolean |
encrypted
Is this connection encrypted? |
static int |
INITIALTIMEOUT
Timeout used directly after opening the Socket. |
private boolean |
internalsocketclosing
Marker whether the socket is closed internally |
private Logger |
mess
|
GJSAServer |
myserv
Reference to the Server object that has launched this ServerThreadBase |
private java.net.InetAddress |
remoteaddress
The client InetAddress object |
private java.net.Socket |
socket
Socket to the client |
private java.io.ObjectInputStream |
socketinputstream
|
private java.io.ObjectOutputStream |
socketoutputstream
|
private java.io.BufferedReader |
socketreader
|
private java.io.BufferedWriter |
socketwriter
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
SocketLayer(GJSAServer gx,
java.net.Socket sx,
boolean ex,
int codex)
Constructor for the SocketLayer. |
Method Summary | |
boolean |
clientMatchesPattern(java.lang.String pattern)
Description of the Method |
void |
closeSocket()
Closes the socket externally. |
java.lang.String |
getClientHostIP()
Returns the IP address of the connected client. |
java.lang.String |
getClientHostName()
Returns the symbolic name of the connected client. |
java.net.InetAddress |
getClientInetAddr()
Returns the InetAddress object for the currently connected client This method will also work for connectionless connect. |
boolean |
isEncrypted()
Returns whether this SocketLayer is on an encrypted connection or not. |
boolean |
isInternalSocketClosing()
Returns whether the socket will be closed internally. |
ServerEnvelope |
readFromSocket()
Reads data from socket. |
ServerEnvelope |
readFromSocket(ServerThreadBase stb)
Read one query from the socket. |
void |
run()
Main method to do something useful with the socket. |
void |
setInternalSocketClosing(boolean b)
Toggles internal socket closing. |
void |
setSoTimeout(int millis)
Set the socket's read timeout. |
void |
writeToSocket(ServerEnvelope se)
Write one answer to the socket. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int INITIALTIMEOUT
public GJSAServer myserv
private java.net.Socket socket
private boolean encrypted
private int connectionencoding
private java.io.BufferedReader socketreader
private java.io.BufferedWriter socketwriter
private java.io.ObjectInputStream socketinputstream
private java.io.ObjectOutputStream socketoutputstream
private Logger mess
private java.lang.String clienthostname
private java.lang.String clienthostip
private java.net.InetAddress remoteaddress
private boolean internalsocketclosing
Constructor Detail |
public SocketLayer(GJSAServer gx, java.net.Socket sx, boolean ex, int codex)
gx
- The GJSA serversx
- The socket to listen on (and write to)ex
- Encryption state of the connection (encrypted or not?)codex
- Encoding mode of the connection.Method Detail |
public ServerEnvelope readFromSocket(ServerThreadBase stb) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public ServerEnvelope readFromSocket() throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void writeToSocket(ServerEnvelope se) throws java.io.IOException
se
- The ServerEnvelope to write to the socket
java.io.IOException
public void setSoTimeout(int millis) throws java.net.SocketException
java.net.SocketException
public boolean clientMatchesPattern(java.lang.String pattern)
pattern
- Description of the Parameter
public java.net.InetAddress getClientInetAddr()
public java.lang.String getClientHostName()
public java.lang.String getClientHostIP()
public boolean isEncrypted()
public void setInternalSocketClosing(boolean b)
b
- Flag whether sockets should be closed internallypublic boolean isInternalSocketClosing()
public void closeSocket()
public void run()
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |