MCPcopy Create free account
hub / github.com/dermesser/libsocket / main

Function main

examples++/unix_client_stream.cpp:9–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7// Builds a connection to /tmp/unixsocket and sends/receives data using it.
8
9int main(void) {
10 using libsocket::unix_stream_client;
11 using std::string;
12
13 string path = "/tmp/unixsocket";
14 char* answer = new char[128];
15
16 memset(answer, 0, 128);
17
18 try {
19 unix_stream_client sock(path);
20
21 sock.snd("Hello World!\n", 13);
22 sock.rcv(answer, 127);
23
24 std::cout << answer;
25 } catch (const libsocket::socket_exception& exc) {
26 std::cerr << exc.mesg;
27 }
28
29 return 0;
30}

Callers

nothing calls this directly

Calls 2

sndMethod · 0.45
rcvMethod · 0.45

Tested by

no test coverage detected