Package net.minecraft.server
Class LanServerPinger
java.lang.Object
java.lang.Thread
net.minecraft.server.LanServerPinger
- All Implemented Interfaces:
Runnable
@Environment(CLIENT) public class LanServerPinger extends Thread
Used to send UDP multicasts to notify other clients of a local game on the same network.
These multicasts will always be sent to 224.0.2.60:4445 where other clients can listen for local games.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields Modifier and Type Field Description private StringaddressPortprivate static LoggerLOGGERprivate Stringmotdprivate booleanrunningprivate DatagramSocketsocketprivate static AtomicIntegerTHREAD_IDFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors Constructor Description LanServerPinger(String motd, String addressPort) -
Method Summary
Modifier and Type Method Description static StringcreateAnnouncement(String motd, String addressPort)Creates a server announcement.voidinterrupt()static StringparseAnnouncementAddressPort(String announcement)static StringparseAnnouncementMotd(String announcement)voidrun()Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
THREAD_ID
-
LOGGER
-
motd
-
socket
-
running
private boolean running -
addressPort
-
-
Constructor Details
-
LanServerPinger
- Throws:
IOException
-
-
Method Details
-
run
public void run() -
interrupt
public void interrupt() -
createAnnouncement
Creates a server announcement.[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]- Parameters:
motd- the message of the dayaddressPort- the address of the server including the IP address and port
-
parseAnnouncementMotd
-
parseAnnouncementAddressPort
-