postgres hook 测试成功
This commit is contained in:
33
tests/daemon_test/ipc_echo_test.c
Normal file
33
tests/daemon_test/ipc_echo_test.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user