Table of Contents

Class WakeOnDemandListener

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Answers Minecraft clients on the server's port while the real server is stopped, so a stopped server can say "I'm asleep, come in and I'll wake up" instead of just refusing the connection.

It speaks the small, stable part of the protocol needed for that: the handshake, the server-list status, and the login disconnect. Pressing Join is what wakes the server — the client re-pings every few seconds while the multiplayer screen is open, so waking on a status request would start the server over and over for people who are not even playing.

With a Playit tunnel this socket is reachable from the internet, so everything it reads is treated as hostile: lengths are bounded before anything is allocated, every connection has a deadline, and the number of them at once is capped.

public sealed class WakeOnDemandListener : IDisposable
Inheritance
WakeOnDemandListener
Implements
Inherited Members

Properties

IsListening

public bool IsListening { get; }

Property Value

bool

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Start(int, Func<WakeStatus>, Action)

Starts answering on port. Returns false when the port can't be bound — the caller keeps working, it just means no wake-on-demand for now.

public bool Start(int port, Func<WakeStatus> status, Action onJoinAttempt)

Parameters

port int
status Func<WakeStatus>
onJoinAttempt Action

Returns

bool

Stop()

Releases the port. Must be called before the real server starts, or Java finds the port busy — and the app would offer to kill the process holding it, which would be this one.

public void Stop()