Package mindustry.net

Class ArcNetProvider

java.lang.Object
mindustry.net.ArcNetProvider
All Implemented Interfaces:
Net.NetProvider

public class ArcNetProvider extends Object implements Net.NetProvider
  • Constructor Details

    • ArcNetProvider

      public ArcNetProvider()
  • Method Details

    • setConnectFilter

      public void setConnectFilter(arc.net.Server.ServerConnectFilter connectFilter)
      Description copied from interface: Net.NetProvider
      Sets a connection filter by IP address. If the filter returns false, the connection will be closed.
      Specified by:
      setConnectFilter in interface Net.NetProvider
    • getConnectFilter

      @Nullable public arc.net.Server.ServerConnectFilter getConnectFilter()
      Specified by:
      getConnectFilter in interface Net.NetProvider
    • connectClient

      public void connectClient(String ip, int port, Runnable success)
      Description copied from interface: Net.NetProvider
      Connect to a server.
      Specified by:
      connectClient in interface Net.NetProvider
    • disconnectClient

      public void disconnectClient()
      Description copied from interface: Net.NetProvider
      Disconnect from the server.
      Specified by:
      disconnectClient in interface Net.NetProvider
    • sendClient

      public void sendClient(Object object, boolean reliable)
      Description copied from interface: Net.NetProvider
      Send an object to the server.
      Specified by:
      sendClient in interface Net.NetProvider
    • pingHost

      public void pingHost(String address, int port, arc.func.Cons<Host> valid, arc.func.Cons<Exception> invalid)
      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 interface Net.NetProvider
    • discoverServers

      public void discoverServers(arc.func.Cons<Host> callback, Runnable done)
      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 interface Net.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 interface Net.NetProvider
    • getConnections

      public Iterable<mindustry.net.ArcNetProvider.ArcConnection> getConnections()
      Description copied from interface: Net.NetProvider
      Return all connected users.
      Specified by:
      getConnections in interface Net.NetProvider
    • hostServer

      public void hostServer(int port) throws IOException
      Description copied from interface: Net.NetProvider
      Host a server at specified port.
      Specified by:
      hostServer in interface Net.NetProvider
      Throws:
      IOException
    • closeServer

      public void closeServer()
      Description copied from interface: Net.NetProvider
      Close the server connection.
      Specified by:
      closeServer in interface Net.NetProvider