mirror of https://github.com/deavminet/libdnet.git
Finished OOP
This commit is contained in:
parent
33c01a53ed
commit
de3006ac35
|
@ -649,23 +649,32 @@ public final class DClient
|
|||
|
||||
/* Send the protocol data */
|
||||
DataMessage protocolDataMsg = new DataMessage(reqRepQueue.getTag(), protocolData);
|
||||
bSendMessage(socket, protocolDataMsg.encode());
|
||||
bool status = bSendMessage(socket, protocolDataMsg.encode());
|
||||
|
||||
/* Receive the server's response */
|
||||
byte[] resp = reqRepQueue.dequeue().getData();
|
||||
|
||||
/* Check if the operation completed successfully */
|
||||
if(resp[0])
|
||||
/* If the send worked */
|
||||
if(status)
|
||||
{
|
||||
/* Set the message of the day */
|
||||
motd = cast(string)resp[1..resp.length];
|
||||
/* Receive the server's response */
|
||||
byte[] resp = reqRepQueue.dequeue().getData();
|
||||
|
||||
/* Check if the operation completed successfully */
|
||||
if(resp[0])
|
||||
{
|
||||
/* Set the message of the day */
|
||||
motd = cast(string)resp[1..resp.length];
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new DClientException("Get motd error");
|
||||
}
|
||||
|
||||
return motd;
|
||||
}
|
||||
/* If the list failed */
|
||||
else
|
||||
{
|
||||
/* TODO: Error handling */
|
||||
throw new DNetworkError("getmotd");
|
||||
}
|
||||
|
||||
return motd;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue