@Environment(value=CLIENT) public class LanServerPinger extends Thread
These multicasts will always be sent to 224.0.2.60:4445
where other clients can listen for local games.
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private String |
addressPort |
private static Logger |
LOGGER |
private String |
motd |
private boolean |
running |
private DatagramSocket |
socket |
private static AtomicInteger |
THREAD_ID |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
LanServerPinger(String motd,
String addressPort) |
Modifier and Type | Method and Description |
---|---|
static String |
createAnnouncement(String motd,
String addressPort)
Creates a server announcement.
|
void |
interrupt() |
static String |
parseAnnouncementAddressPort(String announcement) |
static String |
parseAnnouncementMotd(String announcement) |
void |
run() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
private static final AtomicInteger THREAD_ID
private static final Logger LOGGER
private final String motd
private final DatagramSocket socket
private boolean running
private final String addressPort
public LanServerPinger(String motd, String addressPort) throws IOException
IOException
public static String createAnnouncement(String motd, String addressPort)
[MOTD]// Specifies the beginning of the message of the dayA message of the day// The message of the day[/MOTD]// Specifies the end of the message of the day.[AD]// Specifies the beginning of the address and the port of the local server.the address of the local server.// Such as192.146.2.1:23132
[/AD]// Specifies the end of the address and port of the local server.
An example of a complete announcement:
[MOTD]A Player's Server[/MOTD][AD]192.168.0.33[/AD]
motd
- the message of the dayaddressPort
- the address of the server including the IP address and port