| 14 | */ |
| 15 | |
| 16 | int main(void) { |
| 17 | using std::string; |
| 18 | |
| 19 | using libsocket::inet_stream; |
| 20 | |
| 21 | string host = "::1"; |
| 22 | string port = "1235"; |
| 23 | string answer; |
| 24 | |
| 25 | answer.resize(32); |
| 26 | |
| 27 | try { |
| 28 | libsocket::inet_stream sock(host, port, LIBSOCKET_IPv6); |
| 29 | |
| 30 | sock >> answer; |
| 31 | |
| 32 | std::cout << answer; |
| 33 | |
| 34 | sock << "Hello back!\n"; |
| 35 | |
| 36 | // sock is closed here automatically! |
| 37 | } catch (const libsocket::socket_exception& exc) { |
| 38 | std::cerr << exc.mesg; |
| 39 | } |
| 40 | |
| 41 | return 0; |
| 42 | } |
nothing calls this directly
no outgoing calls
no test coverage detected