-
The above code throws an error. Here's what happens: Compilation is done as follows. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Can you print the string you pass to the library? Please make sure it is valid JSON. |
Beta Was this translation helpful? Give feedback.
-
In the SaveToDatabase function std::cout << message << std::endl; I'll add it and print it out.
This is the result of cout.
Do you also need client code? |
Beta Was this translation helpful? Give feedback.
-
Your provided input is 2263 characters, that tells me that when there are two clients, the two strings get combined into one. You need to make sure that you are only parsing one string at a time.
I suspect that your client messages don't end with a newline, and thus |
Beta Was this translation helpful? Give feedback.
-
In the above case, only one client's transmission was received. Next, transmissions from multiple clients were sent simultaneously (case in which an error occurs). The server is receiving information from 30 clients.
|
Beta Was this translation helpful? Give feedback.
[json.exception.parse_error.101] parse error at line 1, column 2264: syntax error while parsing value - unexpected '{'; expected end of input.
Your provided input is 2263 characters, that tells me that when there are two clients, the two strings get combined into one. You need to make sure that you are only parsing one string at a time.
I suspect that your client messages don't end with a newline, and thus
std::getline
pulls them both at once.