Socket Manager
The SocketManager
class is useful to dynamically manage communication by sockets
Author
N7ghtm4r3 - Tecknobit
Since
2.0.2
Inheritors
Constructors
Link copied to clipboard
Constructor to init SocketManager
Constructor to init SocketManager
Types
Link copied to clipboard
The
Listener
class is useful to manage dynamically the listeners when the allowMultipleListeners is set to "true"
, allowing the communication and, eventually, the interruption of the routine of the listenerLink copied to clipboard
enum StandardResponseCode
StandardResponseCode
list of available response status codeProperties
Link copied to clipboard
allowMultipleListeners
whether accept multiple listeners at the same timeLink copied to clipboard
continueSingleRoutine
whether continue the routine for the single listener if allowMultipleListeners is set to "false"
Link copied to clipboard
currentHost
current server host used in the communicationLink copied to clipboard
currentServerPort
current server port used in the communicationLink copied to clipboard
defaultErrorResponse
default error responseLink copied to clipboard
defaultSuccessResponse
default successful responseLink copied to clipboard
"executor"
of the routinesLink copied to clipboard
Link copied to clipboard
Link copied to clipboard
NEW_LINE_REPLACER
is the constants which indicates the replacer to use when the content message contains multiple linesLink copied to clipboard
publicHostAddress
public host addressLink copied to clipboard
serverSocket
socket managed by the serverFunctions
Link copied to clipboard
Method to accept a new socket request No-any params required
Link copied to clipboard
Method to accept a new socket request
Link copied to clipboard
Method to get allowMultipleListeners instance No-any params required
Link copied to clipboard
Method to stop the communication No-any params required
Link copied to clipboard
Method to get if the listener's workflow needs to continue or not Any param required
Link copied to clipboard
Method to get if the listener's workflow needs to continue or not
Link copied to clipboard
Method to get serverSocket instance No-any params required
Link copied to clipboard
Method to get socket instance No-any params required
Link copied to clipboard
Method to get currentServerPort instance No-any params required
Link copied to clipboard
Method to get executor instance No-any params required
Link copied to clipboard
This method is used to get an ip address from a Socket
Link copied to clipboard
Method to get listeners instance No-any params required
Link copied to clipboard
Method to get serverUse instance No-any params required
Link copied to clipboard
Method to read a content message received with the socket request No-any params required
Method to read a content message received with the socket request
Link copied to clipboard
Method to read the last content message red in the stream with the socket request No-any params required
Link copied to clipboard
Method to send the defaultErrorResponse No-any params required
Link copied to clipboard
Method to send the defaultErrorResponse
Link copied to clipboard
Method to send the defaultSuccessResponse No-any params required
Link copied to clipboard
Method to send the defaultSuccessResponse
Link copied to clipboard
Method to set the default error response to send as error
Link copied to clipboard
Method to set the default successful response to send as success
Link copied to clipboard
Method to start a new listener
Link copied to clipboard
Method to stop the listener's workflow No-any params required
Link copied to clipboard
Method to stop the listener's workflow Any param required
SocketManager socketManager = new SocketManager(false);
socketManager.startListener(3218, new Runnable() {
public void run() {
while (socketManager.continueListening()) {
// do listener's workflow
}
// listener's workflow when has been stopped
}
});
// your code's workflow
socketManager.stopListener(); // --> the single listener will be stopped
Content copied to clipboard
Link copied to clipboard
Method to stop the listener's workflow
Link copied to clipboard
Method to write a content message to send with the socket request
Link copied to clipboard
Method to write a content message to send with the socket request
Link copied to clipboard
Method to write a plain content message to send with the socket request
Link copied to clipboard
Method to write a plain content message to send with the socket request