aboutsummaryrefslogtreecommitdiff
path: root/apiosend.c
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-10-26 18:34:21 +0100
committerubq323 <ubq323@ubq323.website>2022-10-26 18:34:21 +0100
commit705db03ebffa24b993f72ca2694ba0982fa80bde (patch)
treeae11eec77e874df369a557af7864bd6aecc3a38c /apiosend.c
parentabdb9c23fd5db2752369c8c807c66080d86ebef9 (diff)
apiosend utility, only basic functionality for now
Diffstat (limited to 'apiosend.c')
-rw-r--r--apiosend.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/apiosend.c b/apiosend.c
new file mode 100644
index 0000000..0a98be0
--- /dev/null
+++ b/apiosend.c
@@ -0,0 +1,37 @@
+#include <sys/types.h>
+#include <stdio.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#define MAXLEN 480
+
+int main() {
+ int sock;
+ if ((sock = socket(AF_UNIX,SOCK_DGRAM,0)) == -1) {
+ perror("socket");
+ return 1;
+ }
+
+ printf("%d\n",EOF);
+
+ struct sockaddr_un addr;
+ memset(&addr, 0, sizeof addr);
+ addr.sun_family = AF_UNIX;
+ strncpy(addr.sun_path, "bees.sock", 10);
+
+ printf("%ld\n",sizeof addr.sun_path);
+
+ char buf[MAXLEN];
+ int i;
+ char c;
+ for (i = 0; i < MAXLEN && (c = getchar())!=EOF; i++)
+ buf[i] = c;
+
+ sendto(sock, buf, i, 0, (struct sockaddr *)&addr, sizeof addr);
+ printf("%ld %ld\n",sizeof addr,sizeof (struct sockaddr_un));
+
+ return 0;
+}
+
+
+