#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>


int main()
{
    int fd = socket(AF_UNIX, SOCK_STREAM, 0);

    struct sockaddr_un addr;

    memset(&addr, 0, sizeof(addr));
    addr.sun_family = AF_UNIX;
    strcpy(addr.sun_path, "/tmp/zvfs.sock");

    connect(fd, (struct sockaddr*)&addr, sizeof(addr));

    char *msg = "hello reactor\n";

    write(fd, msg, strlen(msg));

    char buf[4096];

    int n = read(fd, buf, sizeof(buf));

    printf("echo: %.*s\n", n, buf);

    close(fd);

    return 0;
}