#include "mxnetwork/socket.hpp"
#include <atomic>
#include <cstdlib>
#include <iostream>
#include <signal.h>
#include <string>
#include <vector>
Go to the source code of this file.
|
| int | main (int argc, char **argv) |
◆ main()
| int main |
( |
int | argc, |
|
|
char ** | argv ) |
Definition at line 9 of file send.cpp.
9 {
10 if (argc != 2) {
11 std::cerr << "Usage: " << argv[0] << " <path>\n";
12 return EXIT_FAILURE;
13 }
14 try {
16 if (sock.connect_unix(argv[1])) {
17 std::cout << "Sending. UDP datagram on socket: " << argv[1] << "...\n";
18 std::string data = "Hello, World!\n";
19 sock.sendto(data.c_str(), data.length());
20 }
22 std::cerr <<
"Exception: " << e.
text() <<
"\n";
23 return EXIT_FAILURE;
24 }
25 return EXIT_SUCCESS;
26}
Lightweight exception wrapper for MXNetwork failures.
std::string text() const
Return the stored error text.
C++ wrapper around the MXNetwork socket API.
@ TYPE_UNIX_DGRAM
UNIX-domain datagram socket.