MCPcopy Create free account
hub / github.com/Extra-Creativity/Modern-Cpp-Basics / main

Function main

08-String & Stream/example/src/client.cpp:6–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <string_view>
5
6int main()
7{
8 Network::Startup();
9 Network::Socket connectSocket{ "127.0.0.1", 34567,
10 Network::Socket::Tag::Connect };
11 if (!connectSocket)
12 {
13 std::println("Connect socket error: {}", Network::GetErrorCode());
14 return 1;
15 }
16
17 Network::OTCPStream stream;
18 stream.open(std::move(connectSocket), 4);
19 std::string str;
20 for (int i = 0; i < 10; i++)
21 {
22 std::cin >> str;
23 stream << str << std::flush;
24 }
25
26 return 0;
27}

Callers

nothing calls this directly

Calls 3

StartupFunction · 0.70
GetErrorCodeFunction · 0.70
openMethod · 0.45

Tested by

no test coverage detected