Skip to content

Commit

Permalink
client won't log if message too long
Browse files Browse the repository at this point in the history
  • Loading branch information
spenserlee committed Mar 24, 2016
1 parent 638e396 commit 8a6206e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@ int main(int argc, char *argv[]) {
} else {
message = "[" + get_time() + "] " + address + " (" + username + "): " + message;
}
if(logactive){
myfile<<message.c_str()<<endl;
}

if (message.length() <= BUFLEN) {
send (sd, message.c_str(), BUFLEN, 0);
if(logactive){
myfile<<message.c_str()<<endl;
}
} else {
cout << "Error: message too long" << endl;
}
Expand Down

0 comments on commit 8a6206e

Please sign in to comment.