Package mindustry.net
Class ArcNetProvider
java.lang.Object
mindustry.net.ArcNetProvider
- All Implemented Interfaces:
Net.NetProvider
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClose the server connection.voidconnectClient(String ip, int port, Runnable success) Connect to a server.voidDisconnect from the server.voiddiscoverServers(arc.func.Cons<Host> callback, Runnable done) Discover servers.voiddispose()Close all connections.arc.net.Server.ServerConnectFilterIterable<mindustry.net.ArcNetProvider.ArcConnection>Return all connected users.voidhostServer(int port) Host a server at specified port.voidPing a host.voidsendClient(Object object, boolean reliable) Send an object to the server.voidsetConnectFilter(arc.net.Server.ServerConnectFilter connectFilter) Sets a connection filter by IP address.
-
Constructor Details
-
ArcNetProvider
public ArcNetProvider()
-
-
Method Details
-
setConnectFilter
public void setConnectFilter(arc.net.Server.ServerConnectFilter connectFilter) Description copied from interface:Net.NetProviderSets a connection filter by IP address. If the filter returnsfalse, the connection will be closed.- Specified by:
setConnectFilterin interfaceNet.NetProvider
-
getConnectFilter
@Nullable public arc.net.Server.ServerConnectFilter getConnectFilter()- Specified by:
getConnectFilterin interfaceNet.NetProvider
-
connectClient
Description copied from interface:Net.NetProviderConnect to a server.- Specified by:
connectClientin interfaceNet.NetProvider
-
disconnectClient
public void disconnectClient()Description copied from interface:Net.NetProviderDisconnect from the server.- Specified by:
disconnectClientin interfaceNet.NetProvider
-
sendClient
Description copied from interface:Net.NetProviderSend an object to the server.- Specified by:
sendClientin interfaceNet.NetProvider
-
pingHost
public void pingHost(String address, int port, arc.func.Cons<Host> valid, arc.func.Cons<Exception> invalid) Description copied from interface:Net.NetProviderPing 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:
pingHostin interfaceNet.NetProvider
-
discoverServers
Description copied from interface:Net.NetProviderDiscover 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:
discoverServersin interfaceNet.NetProviderdone- is the callback that should run after discovery.
-
dispose
public void dispose()Description copied from interface:Net.NetProviderClose all connections.- Specified by:
disposein interfaceNet.NetProvider
-
getConnections
Description copied from interface:Net.NetProviderReturn all connected users.- Specified by:
getConnectionsin interfaceNet.NetProvider
-
hostServer
Description copied from interface:Net.NetProviderHost a server at specified port.- Specified by:
hostServerin interfaceNet.NetProvider- Throws:
IOException
-
closeServer
public void closeServer()Description copied from interface:Net.NetProviderClose the server connection.- Specified by:
closeServerin interfaceNet.NetProvider
-