public abstract class ATCPPing extends APing
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
ATCPPing.PacketReader |
protected static interface |
ATCPPing.PacketWriter |
| Modifier and Type | Field and Description |
|---|---|
protected int |
connectTimeout |
protected int |
protocolVersion |
protected int |
readTimeout |
protected ITCPSocketFactory |
socketFactory |
| Constructor and Description |
|---|
ATCPPing(ITCPSocketFactory socketFactory,
int connectTimeout,
int readTimeout,
int protocolVersion) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected ITCPSocket |
connect(ServerAddress serverAddress)
Connect a socket to the given server address.
|
protected void |
prepareResponse(ServerAddress serverAddress,
com.google.gson.JsonObject response)
Prepare the response by adding default server information.
|
protected abstract void |
readPacket(MCInputStream is,
int packetId,
ATCPPing.PacketReader packetReader)
Read a packet from the input stream.
|
protected abstract void |
writePacket(MCOutputStream os,
int packetId,
ATCPPing.PacketWriter packetWriter)
Write a packet to the output stream.
|
getDefaultPort, ping, prepareResponseprotected final ITCPSocketFactory socketFactory
protected final int connectTimeout
protected final int readTimeout
protected final int protocolVersion
public ATCPPing(ITCPSocketFactory socketFactory, int connectTimeout, int readTimeout, int protocolVersion)
protected final ITCPSocket connect(ServerAddress serverAddress) throws java.io.IOException
serverAddress - The server addressjava.io.IOException - If an I/O error occursConnectTimeoutException - If the connection timed outConnectionRefusedException - If the connection was refusedpublic void close()
throws java.lang.Exception
java.lang.Exceptionprotected abstract void writePacket(MCOutputStream os, int packetId, ATCPPing.PacketWriter packetWriter) throws java.io.IOException
os - The output streampacketId - The packet idpacketWriter - The packet writerjava.io.IOException - If an I/O error occursprotected abstract void readPacket(MCInputStream is, int packetId, ATCPPing.PacketReader packetReader) throws java.io.IOException
is - The input streampacketId - The packet idpacketReader - The packet readerjava.io.IOException - If an I/O error occursprotected final void prepareResponse(ServerAddress serverAddress, com.google.gson.JsonObject response)
APing.prepareResponse(ServerAddress, JsonObject, int) for more information.serverAddress - The server addressresponse - The response