#include #include #include #include int main(int argc, char *argv[]) { int fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd < 0) { perror("socket"); return 1; } struct sockaddr_un addr = { .sun_family = AF_UNIX, .sun_path = "socket", }; if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("connect"); return 1; } int data = 42; if (write(fd, &data, sizeof(data)) < 0) { perror("write"); return 1; } read(fd, &data, sizeof(data)); return 0; }