Finished OOP

This commit is contained in:
Tristan B. Kildaire 2021-01-27 23:05:06 +02:00
parent 33c01a53ed
commit de3006ac35
1 changed files with 20 additions and 11 deletions

View File

@ -649,8 +649,11 @@ public final class DClient
/* Send the protocol data */ /* Send the protocol data */
DataMessage protocolDataMsg = new DataMessage(reqRepQueue.getTag(), protocolData); DataMessage protocolDataMsg = new DataMessage(reqRepQueue.getTag(), protocolData);
bSendMessage(socket, protocolDataMsg.encode()); bool status = bSendMessage(socket, protocolDataMsg.encode());
/* If the send worked */
if(status)
{
/* Receive the server's response */ /* Receive the server's response */
byte[] resp = reqRepQueue.dequeue().getData(); byte[] resp = reqRepQueue.dequeue().getData();
@ -662,11 +665,17 @@ public final class DClient
} }
else else
{ {
/* TODO: Error handling */ throw new DClientException("Get motd error");
} }
return motd; return motd;
} }
/* If the list failed */
else
{
throw new DNetworkError("getmotd");
}
}
/** /**
* Disconnect from the server * Disconnect from the server