Package mindustry.net
Class ArcNetProvider
java.lang.Object
mindustry.net.ArcNetProvider
- All Implemented Interfaces:
Net.NetProvider
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Close the server connection.void
connectClient
(String ip, int port, Runnable success) Connect to a server.void
Disconnect from the server.void
discoverServers
(Cons<Host> callback, Runnable done) Discover servers.void
dispose()
Close all connections.Iterable<mindustry.net.ArcNetProvider.ArcConnection>
Return all connected users.void
hostServer
(int port) Host a server at specified port.void
Ping a host.void
sendClient
(Object object, boolean reliable) Send an object to the server.void
setConnectFilter
(Server.ServerConnectFilter connectFilter) Sets a connection filter by IP address.
-
Constructor Details
-
ArcNetProvider
public ArcNetProvider()
-
-
Method Details
-
setConnectFilter
Description copied from interface:Net.NetProvider
Sets a connection filter by IP address. If the filter returnsfalse
, the connection will be closed.- Specified by:
setConnectFilter
in interfaceNet.NetProvider
-
connectClient
Description copied from interface:Net.NetProvider
Connect to a server.- Specified by:
connectClient
in interfaceNet.NetProvider
-
disconnectClient
public void disconnectClient()Description copied from interface:Net.NetProvider
Disconnect from the server.- Specified by:
disconnectClient
in interfaceNet.NetProvider
-
sendClient
Description copied from interface:Net.NetProvider
Send an object to the server.- Specified by:
sendClient
in interfaceNet.NetProvider
-
pingHost
Description copied from interface:Net.NetProvider
Ping a host. If an error occurred, failed() should be called with the exception. This method should block. If the port is the default mindustry port (6567), SRV records are checked too.- Specified by:
pingHost
in interfaceNet.NetProvider
-
discoverServers
Description copied from interface:Net.NetProvider
Discover servers. This should run the callback regardless of whether any servers are found. Should not block. Callback should be run on the main thread.- Specified by:
discoverServers
in interfaceNet.NetProvider
done
- is the callback that should run after discovery.
-
dispose
public void dispose()Description copied from interface:Net.NetProvider
Close all connections.- Specified by:
dispose
in interfaceNet.NetProvider
-
getConnections
Description copied from interface:Net.NetProvider
Return all connected users.- Specified by:
getConnections
in interfaceNet.NetProvider
-
hostServer
Description copied from interface:Net.NetProvider
Host a server at specified port.- Specified by:
hostServer
in interfaceNet.NetProvider
- Throws:
IOException
-
closeServer
public void closeServer()Description copied from interface:Net.NetProvider
Close the server connection.- Specified by:
closeServer
in interfaceNet.NetProvider
-