27 lines
561 B
C
27 lines
561 B
C
/*
|
|
Inter-process communicating socket, useful for local testing and admin
|
|
playing.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <sys/socket.h>
|
|
#include <sys/un.h>
|
|
|
|
#define MAXBUFFSIZE 4194304 /* 4.0MiB */
|
|
|
|
int plr_socket_unix_try_connect(const char *filepath) {
|
|
int sock = 0;
|
|
|
|
if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
|
|
perror("Error creating client UNIX socket: ");
|
|
return -1;
|
|
}
|
|
|
|
struct sockaddr_un remote = {0};
|
|
remote.sun_family = AF_UNIX;
|
|
strcpy(remote.sun_path, filepath);
|
|
int const remote_len = SUN_LEN(&remote);
|
|
|
|
return 0;
|
|
}
|