diff options
Diffstat (limited to 'works')
| -rw-r--r-- | works/life/computer-network-experiment/.vscode/launch.json | 16 | ||||
| -rw-r--r-- | works/life/computer-network-experiment/Common.cpp | 2 | ||||
| -rw-r--r-- | works/life/computer-network-experiment/client.cpp | 4 | 
3 files changed, 19 insertions, 3 deletions
diff --git a/works/life/computer-network-experiment/.vscode/launch.json b/works/life/computer-network-experiment/.vscode/launch.json new file mode 100644 index 0000000..882a540 --- /dev/null +++ b/works/life/computer-network-experiment/.vscode/launch.json @@ -0,0 +1,16 @@ +{ +    // Use IntelliSense to learn about possible attributes. +    // Hover to view descriptions of existing attributes. +    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +    "version": "0.2.0", +    "configurations": [ +        { +            "name": "Launch server.", +            "type": "gdb", +            "request": "launch", +            "target": "${workspaceRoot}/build/server", +            "cwd": "${workspaceRoot}", +            "valuesFormatting": "parseText" +        } +    ] +}
\ No newline at end of file diff --git a/works/life/computer-network-experiment/Common.cpp b/works/life/computer-network-experiment/Common.cpp index 22f8b63..e4615fc 100644 --- a/works/life/computer-network-experiment/Common.cpp +++ b/works/life/computer-network-experiment/Common.cpp @@ -116,7 +116,7 @@ std::string SafeReadUntil(int socket, char c, std::string &rest) {      bool b = false;
      for (int i = 0; i < received_number; i++) {
 -      if (buffer[i] == '\n') {
 +      if (buffer[i] == c) {
          result.append(buffer, i);
          rest = std::string(buffer + i + 1, received_number - i - 1);
          b = true;
 diff --git a/works/life/computer-network-experiment/client.cpp b/works/life/computer-network-experiment/client.cpp index 2494bae..489948f 100644 --- a/works/life/computer-network-experiment/client.cpp +++ b/works/life/computer-network-experiment/client.cpp @@ -44,9 +44,9 @@ int Main() {      name = ReadInputLine();
    }
 +  name.push_back(CRUT('\n'));
    String name_data = ConvertCharString(name);
 -  SafeSend(client_socket,
 -           std::string_view{name_data.data(), name_data.size() + 1});
 +  SafeSend(client_socket, name_data);
    CloseSocket(client_socket);
    return 0;
  | 
