- java.lang.Object
-
- dev.bitbite.networking.ServerListener
-
public abstract class ServerListener extends java.lang.ObjectThis class contains all functions which, if registered at the server object, will be called when certain events are happening.- See Also:
Server
-
-
Constructor Summary
Constructors Constructor Description ServerListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonAccept(CommunicationHandler ch)Will be called once a client has been accepted by the servervoidonAcceptEnd()Will be called once the server stops to accept clientsvoidonAcceptFailed(java.lang.Exception e)Will be called if an error occures while trying to accept a clientvoidonAcceptStart()Will be called before the server starts to accept clientsvoidonClose()Will be called before the closing process of the server is beeing initiatedvoidonCloseEnd()Will be called once the server has been closed successfullyvoidonCloseFailed(java.lang.Exception e)Will be called if an error occures while trying to close the servervoidonCommunicationHandlerClose(CommunicationHandler ch)Will be called before a CommunicationHandler is tried to be closedvoidonCommunicationHandlerCloseEnd(CommunicationHandler ch)Will be called once a CommunicationHandler is closedvoidonCommunicationHandlerCloseFailed(CommunicationHandler ch, java.lang.Exception exception)Will be called if the closing process failsvoidonCommunicationHandlerInitFailed(java.lang.Exception exception)Will be called if an error occures while trying to init the IOHandler inside the CommunicationHandlervoidonSocketClosed(java.lang.Exception exception)Will be fired if the ServerSocket is closed while Client tried to connect.voidonSocketClosed(java.lang.Exception exception, java.lang.String clientAddress)Will be fired if the ServerSocket is closed while Client tried to connect.voidonStart()Will be called before server startupvoidonStartFailed(java.lang.Exception e)Will be called if server start failedvoidonStartSuccess()Will be called after successful server start
-
-
-
Method Detail
-
onStart
public void onStart()
Will be called before server startup
-
onStartFailed
public void onStartFailed(java.lang.Exception e)
Will be called if server start failed- Parameters:
e- the exception thrown while trying to start the server
-
onStartSuccess
public void onStartSuccess()
Will be called after successful server start
-
onAccept
public void onAccept(CommunicationHandler ch)
Will be called once a client has been accepted by the server- Parameters:
ch- the CommunicationHandler associated with the client that just connected
-
onAcceptStart
public void onAcceptStart()
Will be called before the server starts to accept clients
-
onAcceptEnd
public void onAcceptEnd()
Will be called once the server stops to accept clients
-
onAcceptFailed
public void onAcceptFailed(java.lang.Exception e)
Will be called if an error occures while trying to accept a client- Parameters:
e- the exception which was thrown
-
onClose
public void onClose()
Will be called before the closing process of the server is beeing initiated
-
onCloseEnd
public void onCloseEnd()
Will be called once the server has been closed successfully
-
onCloseFailed
public void onCloseFailed(java.lang.Exception e)
Will be called if an error occures while trying to close the server- Parameters:
e- the exception which was thrown
-
onCommunicationHandlerInitFailed
public void onCommunicationHandlerInitFailed(java.lang.Exception exception)
Will be called if an error occures while trying to init the IOHandler inside the CommunicationHandler- Parameters:
exception- which was thrown
-
onCommunicationHandlerClose
public void onCommunicationHandlerClose(CommunicationHandler ch)
Will be called before a CommunicationHandler is tried to be closed- Parameters:
ch- CommunicationHandler that is going to be closed
-
onCommunicationHandlerCloseEnd
public void onCommunicationHandlerCloseEnd(CommunicationHandler ch)
Will be called once a CommunicationHandler is closed- Parameters:
ch- CommunicationHandler that has been closed
-
onCommunicationHandlerCloseFailed
public void onCommunicationHandlerCloseFailed(CommunicationHandler ch, java.lang.Exception exception)
Will be called if the closing process fails- Parameters:
ch- CommunicationHandler which closing process failedexception- which was thrown during the process of closing the CommunicationHandler
-
onSocketClosed
public void onSocketClosed(java.lang.Exception exception)
Will be fired if the ServerSocket is closed while Client tried to connect.- Parameters:
exception- which is thrown during the process of client acceptance.
-
onSocketClosed
public void onSocketClosed(java.lang.Exception exception, java.lang.String clientAddress)Will be fired if the ServerSocket is closed while Client tried to connect.- Parameters:
exception- which is thrown during the process of client acceptance.clientAddress- of the closed Socket
-
-