Package org.omegazero.net.common
Interface NetworkApplication
- All Superinterfaces:
Runnable
- All Known Subinterfaces:
NetClientManager
,NetServer
- All Known Implementing Classes:
DTLSClientManager
,DTLSServer
,PlainTCPClientManager
,PlainTCPServer
,PlainUDPClientManager
,PlainUDPServer
,TCPClientManager
,TCPServer
,TLSClientManager
,TLSServer
,UDPClientManager
,UDPServer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this application, closing all bound and connected sockets and stopping the main loop, causing a call tostart()
to return.void
init()
Initializes this application.default void
run()
Method which implements theRunnable.run()
function.
This method is equivalent tostart()
, except that anyIOException
s thrown are wrapped into aRuntimeException
.void
start()
Runs the main loop of this instance.
-
Method Details
-
init
Initializes this application.- Throws:
IOException
- If an IO error occurs during initialization
-
close
Closes this application, closing all bound and connected sockets and stopping the main loop, causing a call tostart()
to return.- Throws:
IOException
- If an IO error occurs
-
start
Runs the main loop of this instance. This loop processes incoming or outgoing connection requests and network traffic.
Under normal circumstances, should never return beforeclose()
is called. Afterclose()
is called, this function should return as soon as possible.
If this method is called beforeinit()
, the behavior is undefined.- Throws:
IOException
- If an IO error occurs during any networking operation
-
run
default void run()Method which implements theRunnable.run()
function.
This method is equivalent tostart()
, except that anyIOException
s thrown are wrapped into aRuntimeException
. An application using this instance may want to usestart()
instead, to properly handle errors.
-