|
|
|
|
|
|
|
|
// Error description handling for humans. |
|
|
// Error description handling for humans. |
|
|
|
|
|
|
|
|
string Networking::DescriptiveError(string Msg, int Errno) { // Form a descriptive error w/ errno. |
|
|
string Networking::DescriptiveError(string Msg, int Errno) { // Form a descriptive error w/ errno. |
|
|
char* s = 0; |
|
|
|
|
|
|
|
|
string s = ""; // Message string. |
|
|
|
|
|
|
|
|
switch(Errno) { |
|
|
|
|
|
|
|
|
switch(Errno) { // Assign the appropriate message. |
|
|
case WSA_INVALID_HANDLE: s = "WSA_INVALID_HANDLE"; break; |
|
|
case WSA_INVALID_HANDLE: s = "WSA_INVALID_HANDLE"; break; |
|
|
case WSA_NOT_ENOUGH_MEMORY: s = "WSA_NOT_ENOUGH_MEMORY"; break; |
|
|
case WSA_NOT_ENOUGH_MEMORY: s = "WSA_NOT_ENOUGH_MEMORY"; break; |
|
|
case WSA_INVALID_PARAMETER: s = "WSA_INVALID_PARAMETER"; break; |
|
|
case WSA_INVALID_PARAMETER: s = "WSA_INVALID_PARAMETER"; break; |
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Msg.append(" "); |
|
|
|
|
|
if(s) { |
|
|
|
|
|
Msg.append(s); |
|
|
|
|
|
|
|
|
Msg.append(" "); // Add a space to the existing message. |
|
|
|
|
|
if(0 < s.length()) { // If we know the message for Errno |
|
|
|
|
|
Msg.append(s); // then append it. |
|
|
} |
|
|
} |
|
|
else { |
|
|
|
|
|
ostringstream ErrNoMsg; |
|
|
|
|
|
ErrNoMsg << " UNKNOWN ErrorNumber = " << Errno; |
|
|
|
|
|
|
|
|
else { // If we don't know what Errno means |
|
|
|
|
|
ostringstream ErrNoMsg; // then say so and pass on Errno as |
|
|
|
|
|
ErrNoMsg << " UNKNOWN ErrorNumber = " << Errno; // well so someone can figure it out. |
|
|
Msg.append(ErrNoMsg.str()); |
|
|
Msg.append(ErrNoMsg.str()); |
|
|
} |
|
|
} |
|
|
return Msg; |
|
|
return Msg; |