Package ch.k43.util
Klasse KSocketServerThread
java.lang.Object
java.lang.Thread
ch.k43.util.KSocketServerThread
- Alle implementierten Schnittstellen:
AutoCloseable
,Runnable
- Bekannte direkte Unterklassen:
KSocketServerThreadSample
Class to handle user connections accepted by KSocketServerListener.
- Siehe auch:
-
Verschachtelte Klassen - Übersicht
Von Klasse geerbte verschachtelte Klassen/Schnittstellen java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Feldübersicht
Von Klasse geerbte Felder java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
close()
Close the socket connection.Return name of authenticated client based on the used client certificate.Return common name (without CN=) of the DN (distinguished name) from the used client certificate.Return used TCP cipher suite (Example: "TLS_AES_256_GCM_SHA384").Return last error.Return used TCP connection protocol (Example: "TLSv1.3").boolean
Return connection state.boolean
Check if data is available without blocking.boolean
Check if connection is TLS secured.int
read
(char[] argData) Read socket into character array.readLine()
Read line from socket.void
run()
Main thread entry point - Will be overwritten by user class.toString()
String representation of object.boolean
write
(byte[] argData) Write byte array to socket.boolean
write
(char[] argData) Write character array to socket.boolean
Write string to socket.boolean
Write line terminated with a platform dependent end-of-line to socket.Von Klasse geerbte Methoden java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, yield
-
Methodendetails
-
close
public void close()Close the socket connection.- Angegeben von:
close
in SchnittstelleAutoCloseable
-
getAuthenticatedClient
Return name of authenticated client based on the used client certificate.- Gibt zurück:
- DN name of peer principal or null if not TLS authenticated
- Seit:
- 2024.05.17
-
getAuthenticatedClientCN
Return common name (without CN=) of the DN (distinguished name) from the used client certificate.- Gibt zurück:
- Common name of peer principal or null if not TLS authenticated
- Seit:
- 2024.05.17
-
getCiphers
Return used TCP cipher suite (Example: "TLS_AES_256_GCM_SHA384").- Gibt zurück:
- TLS cipher suite or null
-
getLastError
Return last error.- Gibt zurück:
- Error message or null
-
getProtocol
Return used TCP connection protocol (Example: "TLSv1.3").- Gibt zurück:
- TLS protocol used or null
-
isConnected
public boolean isConnected()Return connection state.- Gibt zurück:
- True if connected, false otherwise
-
isDataAvailable
public boolean isDataAvailable()Check if data is available without blocking.- Gibt zurück:
- True if data is available, false otherwise
-
isSecuredConnection
public boolean isSecuredConnection()Check if connection is TLS secured.- Gibt zurück:
- True if connection is TLS secured, false otherwise
-
read
public int read(char[] argData) Read socket into character array.- Parameter:
argData
- Character buffer- Gibt zurück:
- Number of bytes read or -1
-
readLine
Read line from socket.- Gibt zurück:
- String read or null for end-of-data
-
run
public void run()Main thread entry point - Will be overwritten by user class. -
toString
String representation of object. -
write
public boolean write(byte[] argData) Write byte array to socket.- Parameter:
argData
- Byte array to be written- Gibt zurück:
- True if successful, false otherwise
-
write
public boolean write(char[] argData) Write character array to socket.- Parameter:
argData
- Character array to be written- Gibt zurück:
- True if successful, false otherwise
-
write
Write string to socket.- Parameter:
argLine
- String to be written- Gibt zurück:
- True if successful, false otherwise
-
writeLine
Write line terminated with a platform dependent end-of-line to socket.- Parameter:
argLine
- String to be written- Gibt zurück:
- True if successful, false otherwise
- Seit:
- 2024.05.25
-