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 */
|
/* 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());
|
||||||
|
|
||||||
/* Receive the server's response */
|
/* If the send worked */
|
||||||
byte[] resp = reqRepQueue.dequeue().getData();
|
if(status)
|
||||||
|
|
||||||
/* Check if the operation completed successfully */
|
|
||||||
if(resp[0])
|
|
||||||
{
|
{
|
||||||
/* Set the message of the day */
|
/* Receive the server's response */
|
||||||
motd = cast(string)resp[1..resp.length];
|
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
|
else
|
||||||
{
|
{
|
||||||
/* TODO: Error handling */
|
throw new DNetworkError("getmotd");
|
||||||
}
|
}
|
||||||
|
|
||||||
return motd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue